improve prod chunk splitting

This commit is contained in:
Pooya Parsa 2018-03-28 11:13:07 +04:30
parent c37992f4c6
commit 428a37acb0
3 changed files with 16 additions and 1 deletions

View File

@ -113,7 +113,15 @@ export default class WebpackClientConfig extends WebpackBaseConfig {
new UglifyJsWebpackPlugin({
parallel: true,
cache: this.options.build.cache,
sourceMap: false
sourceMap: false,
extractComments: {
filename: 'LICENSES'
},
uglifyOptions: {
output: {
comments: /^\**!|@preserve|@license|@cc_on/
}
}
})
]
}

View File

@ -58,6 +58,7 @@ export default {
splitChunks: {
chunks: 'all',
automaticNameDelimiter: '.',
name: undefined,
cacheGroups: {}
}
},

View File

@ -177,6 +177,12 @@ Options.from = function (_options) {
options.generate.fallback = '404.html'
}
// Enable [name] when analyze or dev mode
if (options.build.optimization.splitChunks.name === undefined &&
(options.dev || options.build.analyze)) {
options.build.optimization.splitChunks.name = true
}
// TODO: remove when mini-css-extract-plugin supports HMR
if (options.dev) {
options.build.extractCSS = false