mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-04 03:17:14 +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({
|
new UglifyJsWebpackPlugin({
|
||||||
parallel: true,
|
parallel: true,
|
||||||
cache: this.options.build.cache,
|
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: {
|
splitChunks: {
|
||||||
chunks: 'all',
|
chunks: 'all',
|
||||||
automaticNameDelimiter: '.',
|
automaticNameDelimiter: '.',
|
||||||
|
name: undefined,
|
||||||
cacheGroups: {}
|
cacheGroups: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -177,6 +177,12 @@ Options.from = function (_options) {
|
|||||||
options.generate.fallback = '404.html'
|
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
|
// TODO: remove when mini-css-extract-plugin supports HMR
|
||||||
if (options.dev) {
|
if (options.dev) {
|
||||||
options.build.extractCSS = false
|
options.build.extractCSS = false
|
||||||
|
Loading…
Reference in New Issue
Block a user