正如标题所述。
该示例来自common-chunk-and-vendor-chunk
webpack.config.js:
module.exports = {
entry: {
pageA: "./pageA",
pageB: "./pageB",
pageC: "./pageC"
},
mode: 'development',
optimization: {
runtimeChunk: 'single',
splitChunks: {
cacheGroups: {
commons: {
chunks: "initial",
minChunks: 2,
maxInitialRequests: 5,
minSize: 0
},
vendor: {
test: /node_modules/,
chunks: "all",
name: "vendor",
priority: 10,
enforce: true
}
}
}
},
output: {
path: path.join(__dirname, "dist"),
filename: "[name].js"
}
};
我希望将runtime chunk
捆绑到vendor chunk
中。我该怎么办
,谢谢。
答案 0 :(得分:0)
自己解决。
module.exports = {
entry: {
pageA: "./pageA",
pageB: "./pageB",
pageC: "./pageC"
},
mode: 'development',
optimization: {
runtimeChunk: {
name: 'vendor',
},
splitChunks: {
cacheGroups: {
commons: {
chunks: "initial",
minChunks: 2,
maxInitialRequests: 5,
minSize: 0
},
vendor: {
test: /node_modules/,
chunks: "all",
name: "vendor",
priority: 10,
enforce: true
}
}
}
},
output: {
path: path.join(__dirname, "dist"),
filename: "[name].js"
}
};
``