Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from uglifyjs to terser #5026

Merged
merged 1 commit into from
Sep 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/react-dev-utils/printBuildError.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ module.exports = function printBuildError(err) {
const message = err != null && err.message;
const stack = err != null && err.stack;

// Add more helpful message for UglifyJs error
// Add more helpful message for Terser error
if (
stack &&
typeof message === 'string' &&
message.indexOf('from UglifyJs') !== -1
message.indexOf('from Terser') !== -1
) {
try {
const matched = /(.+)\[(.+):(.+),(.+)\]\[.+\]/.exec(stack);
Expand Down
2 changes: 1 addition & 1 deletion packages/react-error-overlay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"rimraf": "^2.6.2",
"settle-promise": "1.0.0",
"source-map": "0.5.6",
"uglifyjs-webpack-plugin": "1.2.5",
"terser-webpack-plugin": "1.1.0",
"webpack": "^4.8.1"
},
"jest": {
Expand Down
6 changes: 3 additions & 3 deletions packages/react-error-overlay/webpack.config.iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

const path = require('path');
const webpack = require('webpack');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');

module.exports = {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
Expand Down Expand Up @@ -49,8 +49,8 @@ module.exports = {
minimizer: [
// This code is embedded as a string, so it would never be optimized
// elsewhere.
new UglifyJsPlugin({
uglifyOptions: {
new TerserPlugin({
terserOptions: {
compress: {
warnings: false,
comparisons: false,
Expand Down
8 changes: 4 additions & 4 deletions packages/react-scripts/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const autoprefixer = require('autoprefixer');
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
Expand Down Expand Up @@ -115,10 +115,10 @@ module.exports = {
},
optimization: {
minimizer: [
new UglifyJsPlugin({
uglifyOptions: {
new TerserPlugin({
terserOptions: {
parse: {
// we want uglify-js to parse ecma 8 code. However, we don't want it
// we want terser to parse ecma 8 code. However, we don't want it
// to apply any minfication steps that turns valid ecma 5 code
// into invalid ecma 5 code. This is why the 'compress' and 'output'
// sections only apply transformations that are ecma 5 safe
Expand Down
2 changes: 1 addition & 1 deletion packages/react-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
"style-loader": "0.21.0",
"svgr": "1.9.2",
"sw-precache-webpack-plugin": "0.11.5",
"terser-webpack-plugin": "1.1.0",
"thread-loader": "1.2.0",
"uglifyjs-webpack-plugin": "1.2.5",
"url-loader": "1.0.1",
"webpack": "4.19.0",
"webpack-dev-server": "3.1.7",
Expand Down