Skip to content

Commit b4e9ca6

Browse files
feat(bundler-vite): improve chunk splitting (#1170)
Co-authored-by: meteorlxy <[email protected]>
1 parent 48ab95c commit b4e9ca6

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

packages/bundler-vite/src/plugins/mainPlugin.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,20 @@ import '@vuepress/client/app'
9797
// also add hash to ssr entry file, so that users could build multiple sites in a single process
9898
entryFileNames: `[name].[hash].mjs`,
9999
}
100-
: {}),
100+
: {
101+
manualChunks(id) {
102+
// move known framework code into a stable chunk
103+
if (
104+
id.includes('plugin-vue:export-helper') ||
105+
/node_modules\/@vuepress\/shared\//.test(id) ||
106+
/node_modules\/vue(-router)?\//.test(id)
107+
) {
108+
return 'framework'
109+
}
110+
111+
return undefined
112+
},
113+
}),
101114
},
102115
preserveEntrySignatures: 'allow-extension',
103116
},

0 commit comments

Comments
 (0)