-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
V2 Scope hoisting seems to break renaming #4687
Comments
I'm fairly confident that you have an |
Just confirmed that there are no calls to eval or use of the Function constructor anywhere in my bundle. |
Strange, even if you build with |
Yes, just double checked. The minify option seems to only apply to contents of modules, not the bundle |
Parcel 1 ran Terser per file/asset, but Parcel 2 does run it on the concatenated bundle |
Is there a documented list of things that cause terser to bail out? I'm testing this on a very small bundle (13 KB) and can't find anything that seems likely. EDIT: Tried running terser directly on output, and it did nothing. Seems like it's bailing out for some reason. |
I figured it out. Terser does not mangle top level names by default, but requires the toplevel option to be set. Parcel should probably do this by default when scope hoisting. |
We should: parcel/packages/optimizers/terser/src/TerserOptimizer.js Lines 31 to 33 in 2668bee
Your outputformat should be commonjs, right? |
That only applies to compression, not mangling. The issue goes away when I have .terserrc with the following config. {
"mangle": {
"toplevel": true
}
} |
👍 Thanks for investigating! |
@fregante That's very unfortunate, can you open a new issue for that? Maybe we can try to shorten the names |
Thanks! Done |
🐛 bug report
Enabling scope hoisting seems to break variable renaming resulting in a significantly increased bundle size.
This may be related to #3664, but I have verified that I have @babel/travers at 7.10.1
🎛 Configuration (.babelrc, package.json, cli command)
🤔 Expected Behavior
Enabling scope hoisting should have shortest possible top level variable names, reducing overall bundle size.
😯 Current Behavior
While scope hoisting itself seems to be working, top level values all have super long generated names (ex: $b10acc16e6462fee040168c6ed2f0$var$actualClose), significantly increasing bundle size. In my case, the scope hoisted size was double that of simple bundling.
🌍 Your Environment
The text was updated successfully, but these errors were encountered: