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

fix: 优化打包

parent 43a42c26
...@@ -62,6 +62,14 @@ module.exports = { ...@@ -62,6 +62,14 @@ module.exports = {
config.optimization.splitChunks({ config.optimization.splitChunks({
chunks: "all", chunks: "all",
cacheGroups: { cacheGroups: {
pdfjs: {
name: "chunk-pdfjs", // split cherryUI into a single package
priority: 21, // the weight needs to be larger than libs and app or it will be packaged into libs or app
test: /[\\/]node_modules[\\/]pdfjs-dist[\\/]es5[\\/]/, // in order to adapt to cnpm
chunks: "all",
reuseExistingChunk: true,
enforce: true
},
cherryUI: { cherryUI: {
name: "chunk-cherryUI", // split cherryUI into a single package name: "chunk-cherryUI", // split cherryUI into a single package
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
...@@ -78,6 +86,14 @@ module.exports = { ...@@ -78,6 +86,14 @@ module.exports = {
reuseExistingChunk: true, reuseExistingChunk: true,
enforce: true enforce: true
}, },
lodash: {
name: "chunk-lodash", // split cherryUI into a single package
priority: 18, // the weight needs to be larger than libs and app or it will be packaged into libs or app
test: /[\\/]node_modules[\\/]lodash[\\/]/, // in order to adapt to cnpm
chunks: "initial",
reuseExistingChunk: true,
enforce: true
},
libs: { libs: {
name: "chunk-libs", name: "chunk-libs",
test: /[\\/]node_modules[\\/]/, test: /[\\/]node_modules[\\/]/,
...@@ -86,20 +102,29 @@ module.exports = { ...@@ -86,20 +102,29 @@ module.exports = {
reuseExistingChunk: true, reuseExistingChunk: true,
enforce: true enforce: true
}, },
api: { svg: {
name: "chunk-api", name: "chunk-svg",
priority: 9, priority: 9,
chunks: "initial",
test: resolve("src/assets/icons/svg"),
reuseExistingChunk: true,
enforce: true
},
images: {
name: "chunk-image",
priority: 8,
chunks: "all", chunks: "all",
minChunks: 3, minChunks: 3,
test: resolve("src/api"), test: resolve("src/assets/images"),
reuseExistingChunk: true, reuseExistingChunk: true,
enforce: true enforce: true
}, },
svg: { api: {
name: "chunk-svg", name: "chunk-api",
priority: 8, priority: 7,
chunks: "initial", chunks: "all",
test: resolve("src/assets/icons/svg"), minChunks: 3,
test: resolve("src/api"),
reuseExistingChunk: true, reuseExistingChunk: true,
enforce: true enforce: true
}, },
......
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