Compare commits

...

1 Commits

Author SHA1 Message Date
Aakansha Doshi
43200a2844 build: optimize bundle size by updating split strategy 2023-09-05 16:13:28 +05:30

View File

@ -89,11 +89,19 @@ module.exports = {
}), }),
], ],
splitChunks: { splitChunks: {
chunks: "async", chunks: "all",
cacheGroups: { cacheGroups: {
vendors: { vendors: {
test: /[\\/]node_modules[\\/]/, test: /[\\/]node_modules[\\/]/,
name: "vendor", // cacheGroupKey here is `commons` as the key of the cacheGroup
name(module, chunks, cacheGroupKey) {
const moduleFileName = module
.identifier()
.split("/")
.reduceRight((item) => item);
const allChunksNames = chunks.map((item) => item.name).join("~");
return `${cacheGroupKey}-${allChunksNames}-${moduleFileName}`;
},
}, },
}, },
}, },