Webpack SplitChunks config
This commit is contained in:
parent
9374464186
commit
0d8ccf2b5f
@ -15,11 +15,19 @@ module.exports = (env) => {
|
|||||||
LaboratoryPage: AllEntry.LaboratoryPage
|
LaboratoryPage: AllEntry.LaboratoryPage
|
||||||
},
|
},
|
||||||
|
|
||||||
output: Output("[name].js"),
|
output: Output("[name].[contenthash].js"),
|
||||||
devtool: 'source-map',
|
devtool: 'source-map',
|
||||||
mode: "development",
|
mode: "development",
|
||||||
resolve: resolve(),
|
resolve: resolve(),
|
||||||
|
|
||||||
|
optimization: {
|
||||||
|
chunkIds: 'named',
|
||||||
|
moduleIds: 'named',
|
||||||
|
splitChunks: {
|
||||||
|
minSize: 1000,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
TypeScriptRules(),
|
TypeScriptRules(),
|
||||||
@ -32,30 +40,6 @@ module.exports = (env) => {
|
|||||||
CssPlugin(),
|
CssPlugin(),
|
||||||
AutoFixCssPlugin()
|
AutoFixCssPlugin()
|
||||||
],
|
],
|
||||||
|
|
||||||
optimization: {
|
|
||||||
splitChunks: {
|
|
||||||
chunks: 'async',
|
|
||||||
minSize: 20000,
|
|
||||||
minRemainingSize: 0,
|
|
||||||
minChunks: 1,
|
|
||||||
maxAsyncRequests: 30,
|
|
||||||
maxInitialRequests: 30,
|
|
||||||
enforceSizeThreshold: 50000,
|
|
||||||
cacheGroups: {
|
|
||||||
defaultVendors: {
|
|
||||||
test: /[\\/]node_modules[\\/]/,
|
|
||||||
priority: -10,
|
|
||||||
reuseExistingChunk: true,
|
|
||||||
},
|
|
||||||
default: {
|
|
||||||
minChunks: 2,
|
|
||||||
priority: -20,
|
|
||||||
reuseExistingChunk: true,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
devServer: {
|
devServer: {
|
||||||
static: {
|
static: {
|
||||||
|
Loading…
Reference in New Issue
Block a user