Twitter | Search | |
Dan Abramov
We have seen numerous reports of production-only bugs from React users caused by the `uglify-es` minifier. This package is not maintained so the bugs in it will not get fixed. Check the minifier your app is using, and avoid `uglify-es`!
Reply Retweet Like More
Dan Abramov Nov 7
Replying to @dan_abramov
(If you use Create React App, you don’t need to worry about this — it has switched to terser before 2.x went stable.)
Reply Retweet Like
Edivan Silva Nov 7
Replying to @dan_abramov
Damn, I just mentioned about uglify-es in a convo yesterday, Preach !
Reply Retweet Like
Matt Hopson Nov 7
Replying to @dan_abramov
I heard they renamed that to “ugly-af”.
Reply Retweet Like
Vítor Balocco Nov 7
Replying to @dan_abramov
Does webpack use `uglify-es` by default? 🤔
Reply Retweet Like
Nejc Vukovic Nov 7
Replying to @dan_abramov @reactjs
& thinking ahead :) owning it!
Reply Retweet Like
Alex Turpin Nov 7
Replying to @dan_abramov
Hm, webpack still uses it through uglifyjs-webpack-plugin
Reply Retweet Like
Dan Abramov Nov 7
Replying to @xeon06
¯\_(ツ)_/¯ Sounds bad.
Reply Retweet Like
Francois Ward Nov 7
Replying to @dan_abramov @xeon06
Newer version of the plugins are back to uglify-js as far as I can tell...they're unfortunately Webpack >= 4 only though, and for some apps the update to Webpack 4 isn't trivial and may not have been prioritized yet... that's awkward.
Reply Retweet Like
Francois Ward Nov 7
Replying to @dan_abramov @xeon06
Webpack 3 itself dependended on a much older version of the plugin that was on the pre-uglify-es version, though I don't know how to tell if that one was affected.
Reply Retweet Like
Dan Abramov Nov 7
Replying to @TheLarkInn
What can we do to help webpack users be aware of this problem? It seems like some versions still ship with uglify-es by default without a deprecation message?
Reply Retweet Like
Even Stensberg Nov 7
Can you submit an issue at webpack/webpack? Not sure where we should log this. Cc
Reply Retweet Like
Sallar Nov 7
Replying to @dan_abramov
Webpack 4’s official docs keep referring to uglify as the official solution which doesn’t even work with es6, react etc. people should use terser which is not mentioned anywhere
Reply Retweet Like
Alex Turpin Nov 7
Maybe I'm not interpreting this correctly, but it looks to me as if webpack@4.25.1 uses uglifyjs-webpack-plugin@1.3.0 which in turn uses uglify-es@3.3.10
Reply Retweet Like
Dan Abramov Nov 7
Reply Retweet Like
Dan Abramov Nov 7
Replying to @sallar
Ironically webpack 4 seems to use uglify-es by default
Reply Retweet Like
Sallar Nov 7
Replying to @dan_abramov
Aah that’s why when I follow their docs to customize uglify (which mentions uglify and not uglify-es) everything breaks.
Reply Retweet Like
Dan Abramov Nov 7
Replying to @sallar
Re: "Doesn't even work with react", you should be compiling JSX before feeding it to a minifier. Re: "doesn't work with ES6", you _may_ compile ES6 with Babel first. Or use terser. In either case, avoid uglify-es.
Reply Retweet Like
Sallar Nov 7
Replying to @dan_abramov
Yes what I meant was if you compile react to an es6 target before uglify (using Babel env) it won’t work because obv es6.
Reply Retweet Like
Francois Ward Nov 7
Replying to @xeon06 @dan_abramov
Yeah and that should be updated, but you can use the updated plugin directly If you just depend on the out of the box stuff then yes, it's still an issue.
Reply Retweet Like