perf: improve uglify plugin options

This commit is contained in:
Pooya Parsa 2017-11-24 19:02:05 +03:30
parent 49d59c68f8
commit 2996160151
No known key found for this signature in database
GPG Key ID: C3C77C557D8883CD
2 changed files with 17 additions and 13 deletions

View File

@ -136,20 +136,23 @@ export default function webpackClientConfig() {
// Minify JS
// https://github.com/webpack-contrib/uglifyjs-webpack-plugin
config.plugins.push(
new UglifyJSPlugin({
cache: true,
sourceMap: true,
extractComments: {
filename: 'LICENSES'
},
uglifyOptions: {
output: {
comments: /^\**!|@preserve|@license|@cc_on/
if (this.options.build.uglify !== false) {
config.plugins.push(
new UglifyJSPlugin(Object.assign({
cache: true,
sourceMap: true,
parallel: true,
extractComments: {
filename: 'LICENSES'
},
uglifyOptions: {
output: {
comments: /^\**!|@preserve|@license|@cc_on/
}
}
}
})
)
}, this.options.build.uglify))
)
}
// Webpack Bundle Analyzer
if (this.options.build.analyze) {

View File

@ -198,6 +198,7 @@ Options.defaults = {
extractCSS: false,
cssSourceMap: undefined,
ssr: undefined,
uglify: {},
publicPath: '/_nuxt/',
filenames: {
css: 'vendor.[contenthash].css',