Skip to content
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

Uglifyjs converts (function(){})() to !function(){} #9

Closed
kurtextrem opened this issue Feb 15, 2019 · 2 comments
Closed

Uglifyjs converts (function(){})() to !function(){} #9

kurtextrem opened this issue Feb 15, 2019 · 2 comments

Comments

@kurtextrem
Copy link
Contributor

...which is unoptimized in older browsers (https://github.com/nolanlawson/optimize-js). Not sure if it's worth trading 2 characters with possibly performance losses in older browsers.

UglifyJS needs those options to stay with (function(){}):
compress: { negate_iife: false, }, output: { wrap_iife: true, },

@iamakulov
Copy link
Owner

I’d agree with mishoo/UglifyJS#1307 (comment) that it’s something that should be handled in browser engines.

Also, might this be already fixed in V8? The optimize-js repo says it’s not maintained.

@iamakulov
Copy link
Owner

iamakulov commented Feb 21, 2019

Not sure if it's worth trading 2 characters with possibly performance losses in older browsers

Whoops, missed the point that you were talking about older browsers.
Anyway, JS is faster than network, and having two fewer bytes to transfer might be better in the end than being 10-20% faster in older Chromes and Firefoxes. (I haven’t tested though.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants