build: improve webpack config (#3463)

This commit is contained in:
Alex Yang
2023-07-29 23:34:52 -07:00
committed by GitHub
parent 05865d51c6
commit cc7de52caf
5 changed files with 33 additions and 9 deletions

View File

@@ -8,9 +8,9 @@ export const productionCacheGroups = {
test: /[\\/]node_modules[\\/]/,
name(module: any) {
// https://hackernoon.com/the-100-correct-way-to-split-your-chunks-with-webpack-f8a9df5b7758
const name =
module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)?.[1] ??
'unknown';
const name = module.context.match(
/[\\/]node_modules[\\/](.*?)([\\/]|$)/
)?.[1];
return `npm-async-${name}`;
},
priority: Number.MAX_SAFE_INTEGER,