From 75f6a261adc3bbab3bdd92ee2753051fc8b269bd Mon Sep 17 00:00:00 2001 From: chuckd Date: Mon, 26 Mar 2018 12:59:30 -0400 Subject: [PATCH] Add UglifyJS plugin --- package.json | 4 ++-- webpack.config.js | 25 ++++++++++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index b701bf8..b7305c2 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "dojo-webpack-plugin-sample", - "version": "2.3.3", + "version": "2.7.1", "devDependencies": { "copy-webpack-plugin": "4.5.1", "css-loader": "0.28.10", "dijit": "1.13.0", "dojo": "1.13.0", "dojo-util": "1.13.0", - "dojo-webpack-plugin": "2.7.0", + "dojo-webpack-plugin": "2.7.1", "dojox": "1.12.2", "less": "2.7.1", "less-loader": "4.1.0", diff --git a/webpack.config.js b/webpack.config.js index 1233d08..0c55868 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -15,6 +15,7 @@ */ var DojoWebpackPlugin = require("dojo-webpack-plugin"); var CopyWebpackPlugin = require("copy-webpack-plugin"); +var UglifyJsPlugin = require("uglifyjs-webpack-plugin"); var path = require("path"); var webpack = require("webpack"); @@ -46,8 +47,7 @@ module.exports = { loaderConfig: require("./js/loaderConfig"), environment: {dojoRoot: "release"}, // used at run time for non-packed resources (e.g. blank.gif) buildEnvironment: {dojoRoot: "node_modules"}, // used at build time - locales: ["en"], - requireFnPropName: "dojo" + locales: ["en"] }), // Copy non-packed resources needed by the app to the release directory @@ -70,9 +70,20 @@ module.exports = { modules: ["node_modules"] }, mode: "production", - devtool: "#source-map", - node: { - process: false, - global: false - } + optimization: { + minimizer: [ + // we specify a custom UglifyJsPlugin here to get source maps in production + new UglifyJsPlugin({ + cache: true, + parallel: true, + uglifyOptions: { + compress: true, + mangle: true, + output: {comments:false} + }, + sourceMap: true + }) + ] + }, + devtool: "#source-map" };