diff --git a/lib/builder/webpack/client.js b/lib/builder/webpack/client.js index d45cc39d4c..43d4c93b53 100644 --- a/lib/builder/webpack/client.js +++ b/lib/builder/webpack/client.js @@ -75,6 +75,30 @@ export default class WebpackClientConfig extends WebpackBaseConfig { return plugins } + customize() { + const config = super.customize(...arguments) + // Make uglifyjs faster + if (!this.options.dev && !config.optimization.minimizer) { + // https://github.com/webpack-contrib/uglifyjs-webpack-plugin + config.optimization.minimizer = [ + new UglifyJsWebpackPlugin({ + parallel: true, + cache: this.options.build.cache, + sourceMap: config.devtool && /source-?map/.test(config.devtool), + extractComments: { + filename: 'LICENSES' + }, + uglifyOptions: { + output: { + comments: /^\**!|@preserve|@license|@cc_on/ + } + } + }) + ] + } + return config + } + config() { const config = super.config() @@ -119,26 +143,6 @@ export default class WebpackClientConfig extends WebpackBaseConfig { ) } - // Make uglifyjs faster - if (!this.options.dev && !config.optimization.minimizer) { - // https://github.com/webpack-contrib/uglifyjs-webpack-plugin - config.optimization.minimizer = [ - new UglifyJsWebpackPlugin({ - parallel: true, - cache: this.options.build.cache, - sourceMap: config.devtool && /source-?map/.test(config.devtool), - extractComments: { - filename: 'LICENSES' - }, - uglifyOptions: { - output: { - comments: /^\**!|@preserve|@license|@cc_on/ - } - } - }) - ] - } - return this.customize(config) } }