nolanlawson / optimize-js

Optimize a JS file for faster parsing (UNMAINTAINED)
https://nolanlawson.github.io/optimize-js
Apache License 2.0
3.75k stars 104 forks source link

Do minifiers undo this? #45

Closed carcinocron closed 7 years ago

carcinocron commented 7 years ago

I'd just like to have clarified (and preemptively warned about) using a minifier after this. I'm worried they might detect the parenthesis as unnecessary and remove them.

yivo commented 7 years ago

Yes, minifiers will undo this. Please, see README: https://github.com/nolanlawson/optimize-js#is-optimize-js-intended-for-library-authors

However, note that optimize-js should run after Uglify, since Uglify strips extra parentheses and also negates IIFEs by default. This also means that if your users apply Uglification to your bundle, then the optimization will be undone.