chore: 编译依赖拆包manualChunks行为

This commit is contained in:
TsMask committed 2024-12-13 18:25:52 +08:00
1 parent 4b1058cff3
commit 7f69bc69bc
2 files changed
+7 -3

No files matched your search

+6 -2
View File
@@ -55,8 +55,12 @@ export default defineConfig(({ mode }) => {
// 用于输出静态资源的块
assetFileNames: 'assets/[name].[hash].[ext]',
manualChunks: id => {
if (id.indexOf('node_modules') !== -1) {
return 'vendor/index';
if (id.includes('node_modules')) {
return id
.toString()
.split('node_modules/')[1]
.split('/')[0]
.toString();
}
},
},