Skip to content

Commit 2c65ca1

Browse files
committed
Fix uglify-js, uglify-es and terser clash
1 parent a42963c commit 2c65ca1

File tree

5 files changed

+41
-227
lines changed

5 files changed

+41
-227
lines changed

packages/app/config/webpack.embed.js

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const merge = require('webpack-merge');
22
const webpack = require('webpack');
33
const path = require('path');
4-
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
4+
const TerserPlugin = require('terser-webpack-plugin');
55

66
const paths = require('./paths');
77

@@ -29,21 +29,7 @@ module.exports = merge(
2929
// // include all types of chunks
3030
// chunks: 'all',
3131
// },
32-
minimizer: [
33-
new UglifyJSPlugin({
34-
cache: true,
35-
parallel: true,
36-
sourceMap: true,
37-
uglifyOptions: {
38-
mangle: {
39-
safari10: true,
40-
},
41-
output: {
42-
comments: false,
43-
},
44-
},
45-
}),
46-
],
32+
minimizer: [new TerserPlugin({ parallel: true })],
4733
concatenateModules: true, // ModuleConcatenationPlugin
4834
namedModules: true, // NamedModulesPlugin()
4935
noEmitOnErrors: true, // NoEmitOnErrorsPlugin

packages/app/config/webpack.prod.js

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const merge = require('webpack-merge');
22
const webpack = require('webpack');
33
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
4-
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
4+
const TerserJSPlugin = require('terser-webpack-plugin');
55
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
66
.BundleAnalyzerPlugin;
77
const normalizeName = require('webpack/lib/optimize/SplitChunksPlugin')
@@ -34,21 +34,7 @@ module.exports = merge(commonConfig, {
3434
stats: 'verbose',
3535

3636
optimization: {
37-
minimizer: [
38-
new UglifyJSPlugin({
39-
cache: true,
40-
parallel: true,
41-
sourceMap: true,
42-
uglifyOptions: {
43-
mangle: {
44-
safari10: true,
45-
},
46-
output: {
47-
comments: false,
48-
},
49-
},
50-
}),
51-
],
37+
minimizer: [new TerserJSPlugin({ parallel: true })],
5238
concatenateModules: true, // ModuleConcatenationPlugin
5339
namedModules: true, // NamedModulesPlugin()
5440
noEmitOnErrors: true, // NoEmitOnErrorsPlugin

packages/app/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
"version": "0.1.1",
44
"license": "MIT",
55
"private": true,
6-
"resolutions": {
7-
"uglify-es": "npm:terser"
8-
},
96
"scripts": {
107
"start": "cross-env LOCAL_SERVER=1 LOCAL_DEV=1 node scripts/start.js",
118
"start:sandbox": "cross-env SANDBOX_ONLY=true node scripts/start.js",
@@ -113,8 +110,8 @@
113110
"style-loader": "^0.21.0",
114111
"sw-precache-webpack-plugin": "^0.11.5",
115112
"terser": "^3.17.0",
113+
"terser-webpack-plugin": "^1.2.3",
116114
"typescript": "3.3.4000",
117-
"uglifyjs-webpack-plugin": "^1.2.5",
118115
"url-loader": "1.0.1",
119116
"webpack": "^4.10.2",
120117
"webpack-bundle-analyzer": "^2.13.1",

packages/homepage/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,11 @@
6767
},
6868
"devDependencies": {
6969
"dotenv": "^6.2.0",
70-
"extract-text-webpack-plugin": "1.0.1",
7170
"gatsby-plugin-remove-trailing-slashes": "^2.0.6",
7271
"gatsby-source-medium": "^2.0.2",
7372
"prettier": "^1.8.2",
7473
"rimraf": "^2.6.2",
75-
"terser": "^3.17.0",
76-
"webpack": "^1.13.3"
74+
"terser": "^3.17.0"
7775
},
7876
"browserslist": [
7977
"> 1%",

0 commit comments

Comments
 (0)