mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
refactor: move UglifyJs after extend for getting updated devtool (#3748)
This commit is contained in:
parent
673a38216f
commit
a3a8c0c9db
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user