From 37001b38bbc7def58f04ba71037ef0693ae610f9 Mon Sep 17 00:00:00 2001 From: Fritz Date: Tue, 22 May 2018 13:31:28 +0900 Subject: [PATCH] build(umd-module): prevent mangling (#4320) * Prevent mangling of names in UMD distribution This makes debugging easier in general. * use `uglifyOptions` --- make-webpack-config.js | 5 +++++ webpack-dist-bundle.config.js | 1 + webpack-dist-standalone.config.js | 1 + 3 files changed, 7 insertions(+) diff --git a/make-webpack-config.js b/make-webpack-config.js index c8e5dbee..74eae669 100644 --- a/make-webpack-config.js +++ b/make-webpack-config.js @@ -52,6 +52,7 @@ module.exports = function(rules, options) { hot: false, separateStylesheets: true, minimize: false, + mangle: false, longTermCaching: false, sourcemaps: false, }, options._special) @@ -69,6 +70,10 @@ module.exports = function(rules, options) { plugins.push( new UglifyJsPlugin({ + uglifyOptions: { + mangle: specialOptions.mangle, + beautify: !specialOptions.mangle, + }, sourceMap: true, }), new webpack.LoaderOptionsPlugin({ diff --git a/webpack-dist-bundle.config.js b/webpack-dist-bundle.config.js index 48b39be3..5872c1ed 100644 --- a/webpack-dist-bundle.config.js +++ b/webpack-dist-bundle.config.js @@ -20,6 +20,7 @@ module.exports = require("./make-webpack-config.js")(rules, { _special: { separateStylesheets: true, minimize: true, + mangle: true, sourcemaps: true, }, diff --git a/webpack-dist-standalone.config.js b/webpack-dist-standalone.config.js index 22477a9f..3f16b5dd 100644 --- a/webpack-dist-standalone.config.js +++ b/webpack-dist-standalone.config.js @@ -20,6 +20,7 @@ module.exports = require("./make-webpack-config.js")(rules, { _special: { separateStylesheets: true, minimize: true, + mangle: true, sourcemaps: true, },