diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index d631fc32a3b..e76f67d60d2 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -378,8 +378,15 @@ module.exports = { // Minify the code. new UglifyJsPlugin({ uglifyOptions: { - ecma: 8, + parse: { + // we want uglify-js to parse ecma 8 code. However we want it to output + // ecma 5 compliant code, to avoid issues with older browsers, this is + // whey we put `ecma: 5` to the compress and output section + // https://github.com/facebook/create-react-app/pull/4234 + ecma: 8, + }, compress: { + ecma: 5, warnings: false, // Disabled because of an issue with Uglify breaking seemingly valid code: // https://github.com/facebook/create-react-app/issues/2376 @@ -391,6 +398,7 @@ module.exports = { safari10: true, }, output: { + ecma: 5, comments: false, // Turned on because emoji and regex is not minified properly using default // https://github.com/facebook/create-react-app/issues/2488