Commit b7644030 authored by 郝聪敏's avatar 郝聪敏

test: 添加分包

parent 427123bd
......@@ -75,93 +75,93 @@ module.exports = {
}
}
],
// optimization: {
// namedModules: true,
// namedChunks: true,
// runtimeChunk: {
// name: 'runtime'
// },
// splitChunks:
// {
// name: false,
optimization: {
namedModules: true,
namedChunks: true,
runtimeChunk: {
name: 'runtime'
},
splitChunks:
{
name: false,
chunks: 'all',
cacheGroups:
{
default: false,
saSdk: {
name: "chunk-sa-sdk", // split cherryUI into a single package
priority: 22, // the weight needs to be larger than libs and app or it will be packaged into libs or app
test: /[\\/]node_modules[\\/]sa-sdk-javascript[\\/]/, // in order to adapt to cnpm
enforce: true
},
// cherryUI: {
// name: 'chunk-cherryUI', // 分离组件库
// priority: 21,
// chunks: 'all',
// cacheGroups:
// {
// default: false,
// saSdk: {
// name: "chunk-sa-sdk", // split cherryUI into a single package
// priority: 22, // the weight needs to be larger than libs and app or it will be packaged into libs or app
// test: /[\\/]node_modules[\\/]sa-sdk-javascript[\\/]/, // in order to adapt to cnpm
// test: /[\\/]node_modules[\\/]@qg[\\/]cherry-ui[\\/]/,
// enforce: true
// },
// // cherryUI: {
// // name: 'chunk-cherryUI', // 分离组件库
// // priority: 21,
// // chunks: 'all',
// // test: /[\\/]node_modules[\\/]@qg[\\/]cherry-ui[\\/]/,
// // enforce: true
// // },
// lodash: {
// name: 'chunk-lodash', // 分离组件库
// priority: 19,
// test: /[\\/]node_modules[\\/]lodash[\\/]/,
// enforce: true
// },
// vue: {
// name: 'chunk-vue', // 分离组件库
// priority: 17,
// test: /[\\/]node_modules[\\/]vue[\\/]/,
// enforce: true
// },
// iview: {
// name: 'chunk-iview', // 分离组件库
// priority: 16,
// test: /[\\/]node_modules[\\/]iview[\\/]/,
// enforce: true
// },
// lodash: {
// name: 'chunk-lodash', // 分离组件库
// priority: 15,
// test: /[\\/]node_modules[\\/]lodash[\\/]/,
// enforce: true
// },
// ravenJs: {
// name: 'chunk-ravenJs', // 分离组件库
// priority: 14,
// test: /[\\/]node_modules[\\/]raven-js[\\/]/,
// enforce: true
// },
// common: {
// name:'chunk-common',
// minChunks: 3,
// priority: 3,
// reuseExistingChunk: true,
// chunks (chunk) {
// return ['login','editor','activity'].includes(chunk.name);
// },
// enforce: true
// },
// vendors:
// {
// name: 'common',
// chunks: 'all',
// minChunks: 3,
// priority: 2,
// test: /node_modules/,
// reuseExistingChunk: true
// },
// styles:
// {
// name: 'common',
// chunks: 'all',
// minChunks: 3,
// priority: 1,
// test: /\.(css|less|scss|stylus)$/,
// priority: 50,
// }
// }
// }
// },
lodash: {
name: 'chunk-lodash', // 分离组件库
priority: 19,
test: /[\\/]node_modules[\\/]lodash[\\/]/,
enforce: true
},
vue: {
name: 'chunk-vue', // 分离组件库
priority: 17,
test: /[\\/]node_modules[\\/]vue[\\/]/,
enforce: true
},
iview: {
name: 'chunk-iview', // 分离组件库
priority: 16,
test: /[\\/]node_modules[\\/]iview[\\/]/,
enforce: true
},
lodash: {
name: 'chunk-lodash', // 分离组件库
priority: 15,
test: /[\\/]node_modules[\\/]lodash[\\/]/,
enforce: true
},
ravenJs: {
name: 'chunk-ravenJs', // 分离组件库
priority: 14,
test: /[\\/]node_modules[\\/]raven-js[\\/]/,
enforce: true
},
common: {
name:'chunk-common',
minChunks: 3,
priority: 3,
reuseExistingChunk: true,
chunks (chunk) {
return ['login','editor','activity'].includes(chunk.name);
},
enforce: true
},
vendors:
{
name: 'common',
chunks: 'all',
minChunks: 3,
priority: 2,
test: /node_modules/,
reuseExistingChunk: true
},
styles:
{
name: 'common',
chunks: 'all',
minChunks: 3,
priority: 1,
test: /\.(css|less|scss|stylus)$/,
priority: 50,
}
}
}
},
devtool:'source-map',
customize(webpackConfig){
// 此外 webpackConfig 为原生生成的 webpack config,可以进行自定义处理
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment