Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

Commit

Permalink
Merge pull request #297 from meandmax/fix-uglify-config
Browse files Browse the repository at this point in the history
fix(wepack.config.prod.js): set ecma option for compress and output to 5
  • Loading branch information
DorianGrey authored Apr 9, 2018
2 parents a11f2f6 + c91a1a2 commit 244650d
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions packages/react-scripts/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,19 @@ module.exports = {
new webpack.DefinePlugin(env.stringified),
// Minify the code.
new UglifyJsPlugin({
parallel: true,
cache: true,
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/facebookincubator/create-react-app/issues/2376
// https://github.com/facebook/create-react-app/issues/2376
// Pending further investigation:
// https://github.com/mishoo/UglifyJS2/issues/2011
comparisons: false,
Expand All @@ -314,15 +319,20 @@ module.exports = {
safari10: true,
},
output: {
ecma: 5,
comments: false,
// Turned on because emoji and regex is not minified properly using default
// https://github.com/facebookincubator/create-react-app/issues/2488
// https://github.com/facebook/create-react-app/issues/2488
ascii_only: true,
},
},
// Use multi-process parallel running to improve the build speed
// Default number of concurrent runs: os.cpus().length - 1
parallel: true,
// Enable file caching
cache: true,
sourceMap: shouldUseSourceMap,
}),
// Note: this won't work without ExtractTextPlugin.extract(..) in `loaders`.
}), // Note: this won't work without ExtractTextPlugin.extract(..) in `loaders`.
new ExtractTextPlugin({
filename: cssFilename,
}),
Expand Down

0 comments on commit 244650d

Please sign in to comment.