From 2e60ec13cb01485153ff466edab1285628172bff Mon Sep 17 00:00:00 2001 From: Jake Marsden Date: Fri, 12 Oct 2018 00:54:45 +1300 Subject: [PATCH] Replace uglifyjs-webpack-plugin with terser-webpack-plugin For the same reasons as https://github.com/webpack/webpack/pull/8036 Webpack will switch to terser by default for 5.x --- webapp/package-lock.json | 37 +++++++++++++++++++++++++++++++++++++ webapp/package.json | 2 +- webapp/webpack.config.js | 8 ++++---- 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/webapp/package-lock.json b/webapp/package-lock.json index a16738a..80cc668 100644 --- a/webapp/package-lock.json +++ b/webapp/package-lock.json @@ -9452,6 +9452,16 @@ "urix": "^0.1.0" } }, + "source-map-support": { + "version": "0.5.9", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.9.tgz", + "integrity": "sha512-gR6Rw4MvUlYy83vP0vxoVNzM6t8MUXqNuRsuBmBHQDu1Fh6X015FrLdgoDKcNdkwGubozq0P4N0Q37UyFVr1EA==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, "source-map-url": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", @@ -9923,6 +9933,33 @@ "uuid": "^3.0.1" } }, + "terser": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-3.10.0.tgz", + "integrity": "sha512-hNh2WR3YxtKoY7BNSb3+CJ9Xv9bbUuOU9uriIf2F1tiAYNA4rNy2wWuSDV8iKcag27q65KPJ/sPpMWEh6qttgw==", + "dev": true, + "requires": { + "commander": "~2.17.1", + "source-map": "~0.6.1", + "source-map-support": "~0.5.6" + } + }, + "terser-webpack-plugin": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.1.0.tgz", + "integrity": "sha512-61lV0DSxMAZ8AyZG7/A4a3UPlrbOBo8NIQ4tJzLPAdGOQ+yoNC7l5ijEow27lBAL2humer01KLS6bGIMYQxKoA==", + "dev": true, + "requires": { + "cacache": "^11.0.2", + "find-cache-dir": "^2.0.0", + "schema-utils": "^1.0.0", + "serialize-javascript": "^1.4.0", + "source-map": "^0.6.1", + "terser": "^3.8.1", + "webpack-sources": "^1.1.0", + "worker-farm": "^1.5.2" + } + }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", diff --git a/webapp/package.json b/webapp/package.json index 1a223de..2291308 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -33,7 +33,7 @@ "resolve-url-loader": "2.3.1", "sass-loader": "7.1.0", "speed-measure-webpack-plugin": "1.2.2", - "uglifyjs-webpack-plugin": "1.3.0", + "terser-webpack-plugin": "1.1.0", "webpack": "4.17.2", "webpack-bundle-analyzer": "2.13.1", "webpack-cli": "3.1.0" diff --git a/webapp/webpack.config.js b/webapp/webpack.config.js index 8868ce1..53a4c7e 100644 --- a/webapp/webpack.config.js +++ b/webapp/webpack.config.js @@ -7,8 +7,8 @@ const CompressionPlugin = require('compression-webpack-plugin'); const HtmlPlugin = require('html-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'); -const SpeedMeasurePlugin = require("speed-measure-webpack-plugin"); -const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); +const SpeedMeasurePlugin = require('speed-measure-webpack-plugin'); +const TerserPlugin = require('terser-webpack-plugin'); module.exports = function (env) { const isForProd = env === 'production'; @@ -55,7 +55,7 @@ module.exports = function (env) { minimize: isForProd, minimizer: [ new OptimizeCssAssetsPlugin({ cssProcessor: cssnano }), - new UglifyJsPlugin({ + new TerserPlugin({ cache: !isForProd, extractComments: { // Separate license comments from the main bundle and add a comment explaining where to find them @@ -65,7 +65,7 @@ module.exports = function (env) { }, parallel: true, sourceMap: true, - uglifyOptions: { + terserOptions: { compress: true, mangle: true }