Permalink
Browse files

Move from uglify-es to terser

  • Loading branch information...
Thomas101 committed Sep 20, 2018
1 parent 28809d4 commit fc61a3a22629284fa0bab559dda1d733438344f4
Showing with 229 additions and 28 deletions.
  1. +210 −8 package-lock.json
  2. +3 −4 package.json
  3. +2 −2 src/guestApi/webpack.config.js
  4. +11 −9 webpack/ElectronRenderer.js
  5. +3 −5 webpack/VanillaJavaScript.js

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -62,12 +62,12 @@
"dependencies": {
"@babel/cli": "7.1.0",
"@babel/core": "7.1.0",
"babel-loader": "8.0.2",
"@babel/plugin-proposal-class-properties": "7.1.0",
"@babel/plugin-proposal-decorators": "7.1.0",
"babel-plugin-transform-react-remove-prop-types": "0.4.15",
"@babel/preset-env": "7.1.0",
"@babel/preset-react": "7.0.0",
"babel-loader": "8.0.2",
"babel-plugin-transform-react-remove-prop-types": "0.4.15",
"clean-webpack-plugin": "0.1.19",
"colors": "1.3.2",
"copy-webpack-plugin": "4.5.2",
@@ -83,8 +83,7 @@
"nyan-progress-webpack-plugin": "1.2.0",
"progress-bar-webpack-plugin": "1.11.0",
"style-loader": "0.23.0",
"uglify-es": "3.3.9",
"uglifyjs-webpack-plugin": "1.3.0",
"terser-webpack-plugin": "1.1.0",
"url-loader": "1.1.1",
"uuid": "3.3.2",
"webpack": "4.19.1",
@@ -5,7 +5,7 @@ const OUT_DIR = path.join(BIN_DIR, 'guestApi')
const devRequire = (n) => require(path.join(ROOT_DIR, 'node_modules', n))
const webpackRequire = (n) => require(path.join(ROOT_DIR, 'webpack', n))

const UglifyJS = devRequire('uglify-es')
const Terser = devRequire('terser')
const CleanWebpackPlugin = devRequire('clean-webpack-plugin')
const CopyWebpackPlugin = devRequire('copy-webpack-plugin')
const { isProduction, isVerboseLog } = webpackRequire('Config')
@@ -30,7 +30,7 @@ module.exports = function (env) {
to: '',
force: true,
transform: isProduction ? (content, path) => {
const res = UglifyJS.minify(content.toString())
const res = Terser.minify(content.toString())
if (res.error) {
throw res.error
} else {
@@ -3,7 +3,7 @@ const { isProduction } = require('./Config')
const ROOT_DIR = path.resolve(path.join(__dirname, '../'))
const devRequire = (n) => require(path.join(ROOT_DIR, 'node_modules', n))
const webpack = devRequire('webpack')
const UglifyJsPlugin = devRequire('uglifyjs-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')

/**
* @param packagePath: the root path of the package
@@ -17,7 +17,16 @@ module.exports = function (packagePath, config) {
config.node.__filename = false

config.optimization = config.optimization || {}
config.optimization.minimize = false
config.optimization.minimizer = [
new TerserPlugin({
terserOptions: {
compress: {
reduce_vars: false // Enabling me seems to remove shouldComponentUpdate etc
}
}
})
]
config.optimization.minimize = isProduction

// Plugins
config.plugins = config.plugins || []
@@ -27,13 +36,6 @@ module.exports = function (packagePath, config) {
__DEV__: false,
'process.env.NODE_ENV': JSON.stringify('production')
}))
config.plugins.push(new UglifyJsPlugin({
uglifyOptions: {
compress: {
reduce_vars: false // Enabling me seems to remove shouldComponentUpdate etc
}
}
}))
}

// Resolve
Oops, something went wrong.

0 comments on commit fc61a3a

Please sign in to comment.