|
@@ -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}`;
|
|
|
+ },
|
|
|
},
|
|
|
},
|
|
|
},
|