import ChainableWebpackConfig from 'webpack-chain' export const spriteChunks = (config: ChainableWebpackConfig) => { config.optimization.splitChunks({ automaticNameDelimiter: '-', chunks: 'all', hidePathInfo: true, cacheGroups: { antdv: { name: 'chunk-antdv', priority: 3, test: /[\\/]node_modules[\\/]ant-design-vue[\\/]/, enforce: true }, el: { name: 'chunk-el', priority: 3, test: /[\\/]node_modules[\\/]_?element-ui(.*)/, enforce: true }, vant: { name: 'chunk-vant', priority: 3, test: /[\\/]node_modules[\\/]vant(.*)/, enforce: true }, crypto: { name: 'chunk-crypto', priority: 3, test: /[\\/]node_modules[\\/]?crypto(.*)/, enforce: true }, vue: { name: 'chunk-vue', test: /[\\/]node_modules[\\/]_?vue(.*)/, // in order to adapt to cnpm priority: 2, enforce: true }, libs: { name: 'libs', test: /[\\/]node_modules[\\/]/, priority: 1, chunks: 'initial' } } }) }