Skip to content

Commit 373b43b

Browse files
committed
Switch from uglify-es to terser
1 parent 7b7acde commit 373b43b

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

packages/react-dev-utils/printBuildError.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ module.exports = function printBuildError(err) {
1313
const message = err != null && err.message;
1414
const stack = err != null && err.stack;
1515

16-
// Add more helpful message for UglifyJs error
16+
// Add more helpful message for Terser error
1717
if (
1818
stack &&
1919
typeof message === 'string' &&
20-
message.indexOf('from UglifyJs') !== -1
20+
message.indexOf('from Terser') !== -1
2121
) {
2222
try {
2323
const matched = /(.+)\[(.+):(.+),(.+)\]\[.+\]/.exec(stack);

packages/react-error-overlay/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"rimraf": "^2.6.2",
6161
"settle-promise": "1.0.0",
6262
"source-map": "0.5.6",
63-
"uglifyjs-webpack-plugin": "1.2.5",
63+
"terser-webpack-plugin": "^1.0.0",
6464
"webpack": "^4.8.1"
6565
},
6666
"jest": {

packages/react-error-overlay/webpack.config.iframe.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
const path = require('path');
1010
const webpack = require('webpack');
11-
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
11+
const TerserPlugin = require('terser-webpack-plugin');
1212

1313
module.exports = {
1414
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
@@ -49,8 +49,8 @@ module.exports = {
4949
minimizer: [
5050
// This code is embedded as a string, so it would never be optimized
5151
// elsewhere.
52-
new UglifyJsPlugin({
53-
uglifyOptions: {
52+
new TerserPlugin({
53+
terserOptions: {
5454
compress: {
5555
warnings: false,
5656
comparisons: false,

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const autoprefixer = require('autoprefixer');
1212
const path = require('path');
1313
const webpack = require('webpack');
1414
const HtmlWebpackPlugin = require('html-webpack-plugin');
15-
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
15+
const TerserPlugin = require('terser-webpack-plugin');
1616
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
1717
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
1818
const ManifestPlugin = require('webpack-manifest-plugin');
@@ -116,10 +116,10 @@ module.exports = {
116116
},
117117
optimization: {
118118
minimizer: [
119-
new UglifyJsPlugin({
120-
uglifyOptions: {
119+
new TerserPlugin({
120+
terserOptions: {
121121
parse: {
122-
// we want uglify-js to parse ecma 8 code. However, we don't want it
122+
// we want terser to parse ecma 8 code. However, we don't want it
123123
// to apply any minfication steps that turns valid ecma 5 code
124124
// into invalid ecma 5 code. This is why the 'compress' and 'output'
125125
// sections only apply transformations that are ecma 5 safe

packages/react-scripts/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"svgr": "1.9.2",
6666
"sw-precache-webpack-plugin": "0.11.5",
6767
"thread-loader": "1.1.5",
68-
"uglifyjs-webpack-plugin": "1.2.5",
68+
"terser-webpack-plugin": "^1.0.0",
6969
"url-loader": "1.0.1",
7070
"webpack": "4.8.3",
7171
"webpack-dev-server": "3.1.7",

0 commit comments

Comments
 (0)