mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-03 19:44:14 +00:00
generate source map for uglify if devtool === #source-map (#3451)
* generate source map for uglify if devtool === #source-map * support different variants of source-map option * change source map to be likes in official webpack repo https://github.com/webpack/webpack/blob/master/lib/WebpackOptionsDefaulter.js#L294 * small code cleanup
This commit is contained in:
parent
cff76965f6
commit
5280e86dfc
@ -98,26 +98,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: false,
|
|
||||||
extractComments: {
|
|
||||||
filename: 'LICENSES'
|
|
||||||
},
|
|
||||||
uglifyOptions: {
|
|
||||||
output: {
|
|
||||||
comments: /^\**!|@preserve|@license|@cc_on/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add HMR support
|
// Add HMR support
|
||||||
if (this.options.dev) {
|
if (this.options.dev) {
|
||||||
config.entry = [
|
config.entry = [
|
||||||
@ -153,6 +133,26 @@ 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 config
|
return config
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user