-
-
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
Warn about potential minification issues? #186
Comments
It would be pretty straightforward to add such a warning in I think the Rollup project should be made aware of this issue as it could be fairly common. Perhaps they can perform some code transforms on their end to avoid this situation in some cases. i.e., don't hoist a function from a module in certain cases. |
Sorry - I mistakenly thought this was a post to the UglifyJS2 project. |
@kzc not at all! thank you for clarifying the issue. I actually misunderstood the problem before – wrapping the So, warning the user is probably a better solution. |
An interesting case with UglifyJS – if you use
eval
orwith
, the containing scope's variable names can't be mangled. Since Rollup puts every module in a single scope, it's much more likely that mangling will fail for the top level of an entire bundle, meaning that a minified Rollup bundle ends up larger than the equivalent Browserify bundle, despite there being less code. (Gzipping goes some way to alleviating this, but not all the way.)Do we try and catch and deal with those cases somehow? E.g. warn, or wrap everything (except declarations) in an IIFE if a module contains a top-level
eval
orwith
? My thinking is that most people wouldn't investigate too deeply before concluding that Rollup was just less efficient than Browserify or Webpack.Via mishoo/UglifyJS#830 (comment)
The text was updated successfully, but these errors were encountered: