Skip to content

Commit 0dd8433

Browse files
committed
Upgrade uglifyjs-webpack-plugin
1 parent 1c69a2f commit 0dd8433

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

packages/react-scripts/config/webpack.config.prod.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const ManifestPlugin = require('webpack-manifest-plugin');
1919
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
2020
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
2121
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
22+
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
2223
const paths = require('./paths');
2324
const getClientEnvironment = require('./env');
2425

@@ -165,7 +166,7 @@ module.exports = {
165166
{
166167
test: /\.(ts|tsx)$/,
167168
include: paths.appSrc,
168-
loader: require.resolve('ts-loader')
169+
loader: require.resolve('ts-loader'),
169170
},
170171
// The notation here is somewhat confusing.
171172
// "postcss" loader applies autoprefixer to our CSS.
@@ -272,20 +273,17 @@ module.exports = {
272273
// Otherwise React will be compiled in the very slow development mode.
273274
new webpack.DefinePlugin(env.stringified),
274275
// Minify the code.
275-
new webpack.optimize.UglifyJsPlugin({
276-
compress: {
277-
warnings: false,
278-
// Disabled because of an issue with Uglify breaking seemingly valid code:
279-
// https://github.com/facebookincubator/create-react-app/issues/2376
280-
// Pending further investigation:
281-
// https://github.com/mishoo/UglifyJS2/issues/2011
282-
comparisons: false,
283-
},
284-
output: {
285-
comments: false,
286-
// Turned on because emoji and regex is not minified properly using default
287-
// https://github.com/facebookincubator/create-react-app/issues/2488
288-
ascii_only: true,
276+
new UglifyJsPlugin({
277+
//test: /.js($|?)/i //Do we need to change this for ts-loader output?
278+
parallel: true,
279+
uglifyOptions: {
280+
ecma: 6,
281+
output: {
282+
comments: false,
283+
// Turned on because emoji and regex is not minified properly using default
284+
// https://github.com/facebookincubator/create-react-app/issues/2488
285+
ascii_only: true,
286+
},
289287
},
290288
sourceMap: shouldUseSourceMap,
291289
}),

packages/react-scripts/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,14 @@
3838
"react-dev-utils": "^3.1.0",
3939
"react-error-overlay": "^1.0.10",
4040
"style-loader": "0.18.2",
41+
"sw-precache-webpack-plugin": "0.11.4",
4142
"ts-jest": "^20.0.7",
4243
"ts-loader": "^2.2.1",
4344
"tslint": "^5.2.0",
4445
"tslint-loader": "^3.5.3",
4546
"tslint-react": "^3.0.0",
4647
"typescript": "~2.4.0",
47-
"sw-precache-webpack-plugin": "0.11.4",
48+
"uglifyjs-webpack-plugin": "^1.0.0-beta.2",
4849
"url-loader": "0.5.9",
4950
"webpack": "3.5.1",
5051
"webpack-dev-server": "2.7.1",

0 commit comments

Comments
 (0)