facebook/create-react-app

disable reduce_vars in uglify-es due to bug in code generation

xaviergonz opened this issue · 4 comments

Is this a bug report?

yes

Did you try recovering your dependencies?

yarn 1.7.0

Which terms did you search for in User Guide?

N/A

Environment

Environment:
OS: Windows 10
Node: 10.5.0
Yarn: 1.7.0
npm: 6.1.0
Watchman: Not Found
Xcode: N/A
Android Studio: Not Found

Description

Basically, in uglify-es, the reduce_vars (set to true by default) sometimes generates bad code as seen in mishoo/UglifyJS#3122

Although it seems to be fixed (to be released in an hypothetical uglify-es 3.3.10), today I found out that actually uglify-es is no longer mantained (see mishoo/UglifyJS#3156), so my recommendation in the time being is to add reduce_vars: false in the compress section of the UglifyJSPlugin for the time being so nobody else finds this problem.

Just created a pull request for it

Another option to consider is to switch to https://github.com/fabiosantoscode/terser
which is a fork of uglify-es by two of the main mantainers, but mantained.

Timer commented

We've switched to terser. Closing.