** Плагин разбивки чанков в Webpack - код ниже - не генерирует antd.bundle.js в рабочем режиме. В режиме разработки все работает нормально и генерируется 3 файла комплекта --act.bundle.js, antd.bundle.js и common.bundle.js. **
optimization: {
splitChunks: {
cacheGroups: {
react: {
test: /[\\/]node_modules[\\/]((react).*[\\/])/,
name: 'common/react.bundle',
chunks: 'all',
},
antd: {
test: /[\\/]node_modules[\\/]((antd).*[\\/])/,
name: 'common/antd.bundle',
chunks: 'all',
},
common: {
test(mod/* , chunk */) {
if (mod.context) {
// Only node_modules are needed
if (!mod.context.includes('node_modules')) {
return false;
}
// But not node modules that contain these key words in the path
if (['react', 'antd'].some((str) => mod.context.includes(str))) {
return false;
}
}
return true;
},
name: 'common/common.bundle',
chunks: 'all',
reuseExistingChunk: true,
},
},
},
},