最近发现同样的配置在不同设备,同平台(Windows 10 Pro
),同一node v10.19.0
&npm v6.13.4
版本但编译结果不同,在他的设备编译结果splitChunks
和配置一样,生效!但同个项目在我的设备编译结果是只有vendors-commons
最后一条生效。
配置来自webpack
官网SplitChunksPlugin
编译结果如图示:
splitChunks: {
chunks: 'all',
cacheGroups: {
styles: {
name: 'vendors-styles',
test: /\.css$/,
enforce: true,
priority: 100
},
antd: {
name: "vendors-antd",
test: /[\\/]node_modules[\\/]antd/,
priority: 10
},
react: {
name: "vendors-react",
test: /[\\/]node_modules[\\/]react/,
priority: 10
},
vconsole: {
name: "vendors-vconsole",
test: /[\\/]node_modules[\\/]vconsole/,
priority: 10
},
commons: {
name: 'vendors-commons',
test: /[\\/]node_modules[\\/]/,
priority: 1
}
}
},
有朋友遇到相同的问题吗?
感激不尽!
Emmm,还是没找到解决方案。