Skip to content

Commit 69425a3

Browse files
authored
Merge pull request #145 from cdacai/cdacai
拆包
2 parents dbf7a05 + 67e7437 commit 69425a3

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

blog-view/vue.config.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,29 @@ module.exports = {
1010
'plugins': '@/plugins'
1111
}
1212
}
13-
}
13+
},
14+
optimization: {
15+
splitChunks: {
16+
cacheGroups: {
17+
vendor: {
18+
test: /[\\/]node_modules[\\/]/,
19+
name(module) {
20+
// get the name. E.g. node_modules/packageName/not/this/part.js
21+
// or node_modules/packageName
22+
const packageName = module.context.match(
23+
/[\\/]node_modules[\\/](.*?)([\\/]|$)/
24+
)[1];
25+
// npm package names are URL-safe, but some servers don't like @ symbols
26+
return `npm.${packageName.replace("@", "")}`;
27+
},
28+
chunks: "all",
29+
enforce: true,
30+
priority: 10,
31+
minSize: 50000, // 50KB
32+
maxSize: 200000,
33+
reuseExistingChunk: true,
34+
},
35+
},
36+
},
37+
},
1438
}

0 commit comments

Comments
 (0)