Browse Source

build: optimize bundle size by updating split strategy

aakansha-bundle
Aakansha Doshi 2 years ago
parent
commit
43200a2844
  1. 12
      src/packages/excalidraw/webpack.prod.config.js

12
src/packages/excalidraw/webpack.prod.config.js

@ -89,11 +89,19 @@ module.exports = { @@ -89,11 +89,19 @@ module.exports = {
}),
],
splitChunks: {
chunks: "async",
chunks: "all",
cacheGroups: {
vendors: {
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}`;
},
},
},
},

Loading…
Cancel
Save