-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Tree-shaking is not working #2497
Comments
To answer your question: The problem is the property access in
Rollup does not (yet) trace function argument values through function calls. In other words, when checking if calling There are plans to improve this but it will probably take some time. So if I understand you correctly, this is a critical piece in tree-shaking Vue.js? This is good to know as this would of course put a little more priority on this. |
Thanks for your quick reply!
Imagine that there is a vue component library which exports many indepedent basic components such as button, form and etc. We bundles it with And in another project, which also uses rollup, I only want to use button from this component library and imports it like |
But it is probably not a side-effect |
I didn't catch the idea why tracking "typeof" matters in this case. No matter how the ternary operator evaluates, the result of the expression would only be relevant to the argument
Bingo, tree-shake it I'm aware that this might be childish analysis, but I think it make sense, right? |
Yes, the
Yes, but we still need to track the function call parameter to know |
Happy to hear that! 😄 |
Hey folks. This is a saved-form message, but rest assured we mean every word. The Rollup team is attempting to clean up the Issues backlog in the hopes that the active and still-needed, still-relevant issues bubble up to the surface. With that, we're closing issues that have been open for an eon or two, and have gone stale like pirate hard-tack without activity. We really appreciate the folks have taken the time to open and comment on this issue. Please don't confuse this closure with us not caring or dismissing your issue, feature request, discussion, or report. The issue will still be here, just in a closed state. If the issue pertains to a bug, please re-test for the bug on the latest version of Rollup and if present, please tag @shellscape and request a re-open, and we'll be happy to oblige. |
How Do We Reproduce?
reproductions in REPL
Expected Behavior
Bar
-related code should be tree-shaken since it is not used and obviously has no side effects.foo
andbar
functions are identical, if anyone concerns.rollup-plugin-vue
. It transpiles.vue
files into independent render functions. Thn importing part of that bundle in another rollup project does not tree-shake the redundant render functions. I traced the problematic code and reproduced it in the REPL.Actual Behavior
Bar
-related code still remains in the bundled output.The text was updated successfully, but these errors were encountered: