-
Notifications
You must be signed in to change notification settings - Fork 546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Global API Treeshaking #19
Conversation
Would this also apply to more core concepts such as Instead of: import Vue from 'vue'
Vue.extend({
...
}) We would do: import { extend } from 'vue'
extend({
...
}) |
@laander |
When it all makes sense, I'm a bit concerned when it comes to documentation. How would we present both modules and UMD APIs in our examples? Off the top of my head, we can:
IMHO 1 is better, but I'm not sure about the maintenance method and whether it can be automated. |
@yyx990803 I assume that everything that registers on/interacts with the global Vue instance can't be extracted, right? E.g. |
@laander these are APIs that globally mutate the |
Naming the function that creates VNodes as With ES modules, we can export the function under any name while the importer is still free to rename it anything. So, IMO, we should export it under a more descriptive name like This would be invisible to users writing templates or JSX (since the import statement is generated by the compiler anyway) and communicate more clearly to render function writer what the function is doing. |
I'm in favor of exporting as much as possible. The other day I was trying to import |
If a codebase only uses the Composition API, is the Options API something that is tree-shaken? |
@onx2 by default it cannot, because we cannot predict what options the users will use. But there will be a compile-time flag to drop it. |
Rendered