chunks
默认是 ['umi']
,可修改,比如做了 vendors 依赖提取之后,会需要在 umi.js
之前加载 vendors.js
。
比如:
export default {
chunks: ['vendors', 'umi']
chainWebpack: function (config, { webpack }) {
config.merge({
optimization: {
minimize: true,
splitChunks: {
chunks: 'all',
minSize: 30000,
minChunks: 3,
automaticNameDelimiter: '.',
cacheGroups: {
vendor: {
name: 'vendors',
test({ resource }) {
return /[\\/]node_modules[\\/]/.test(resource);
},
priority: 10,
},
},
},
}
});
},
}