|
@@ -79,6 +79,35 @@ module.exports = {
|
|
|
const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
|
|
|
types.forEach(type => addStyleResource(config.module.rule('scss').oneOf(type)))
|
|
|
|
|
|
+ config.optimization.splitChunks({
|
|
|
+ chunks: 'all',
|
|
|
+ cacheGroups: {
|
|
|
+ vendors: {
|
|
|
+ name: 'chunk-vendors',
|
|
|
+ test: /[\\/]node_modules[\\/]/,
|
|
|
+ chunks: 'all',
|
|
|
+ priority: 2,
|
|
|
+ reuseExistingChunk: true,
|
|
|
+ enforce: true
|
|
|
+ },
|
|
|
+ vantUi: {
|
|
|
+ name: 'chunk-vantUi',
|
|
|
+ test: /[\\/]node_modules[\\/]vant[\\/]/,
|
|
|
+ chunks: 'all',
|
|
|
+ priority: 3,
|
|
|
+ reuseExistingChunk: true,
|
|
|
+ enforce: true
|
|
|
+ },
|
|
|
+ commons: {
|
|
|
+ name: 'chunk-commons',
|
|
|
+ test: resolve('src/components'), // can customize your rules
|
|
|
+ minChunks: 3, // minimum common number
|
|
|
+ priority: 5,
|
|
|
+ reuseExistingChunk: true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
config.plugin('define').tap(args => {
|
|
|
args[0]['process.env'] = Object.assign({}, args[0]['process.env'], env)
|
|
|
return args
|