mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-03 10:57:18 +00:00
improve prod chunk splitting
This commit is contained in:
parent
c37992f4c6
commit
428a37acb0
@ -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/
|
||||
}
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ export default {
|
||||
splitChunks: {
|
||||
chunks: 'all',
|
||||
automaticNameDelimiter: '.',
|
||||
name: undefined,
|
||||
cacheGroups: {}
|
||||
}
|
||||
},
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user