From 6777531a33bdad9f5427c8ab52da5c82239b1340 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 31 Mar 2018 13:27:21 +0200 Subject: [PATCH 1/3] Revert to use ecma 5 in uglifyOptions --- packages/react-scripts/config/webpack.config.prod.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index d631fc32a3b..78c733d002c 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -378,7 +378,7 @@ module.exports = { // Minify the code. new UglifyJsPlugin({ uglifyOptions: { - ecma: 8, + ecma: 5, compress: { warnings: false, // Disabled because of an issue with Uglify breaking seemingly valid code: From 0915f8858eddef19dfdb348d961803da5f45f066 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 1 Apr 2018 10:39:21 +0200 Subject: [PATCH 2/3] remove explicit ecma version from uglifyOptions settings The defaults are already what we want --- packages/react-scripts/config/webpack.config.prod.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 78c733d002c..3de05a29da4 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -378,7 +378,6 @@ module.exports = { // Minify the code. new UglifyJsPlugin({ uglifyOptions: { - ecma: 5, compress: { warnings: false, // Disabled because of an issue with Uglify breaking seemingly valid code: From 3cc48672ab354d3638fd8a35bac1ee6382ad1c2a Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 2 Apr 2018 17:17:00 +0200 Subject: [PATCH 3/3] be explicit of where we use ecma: 8 and ecma: 5 --- packages/react-scripts/config/webpack.config.prod.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 3de05a29da4..e76f67d60d2 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -378,7 +378,15 @@ module.exports = { // Minify the code. new UglifyJsPlugin({ uglifyOptions: { + 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 @@ -390,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