Skip to content

Commit 2c49f7b

Browse files
committed
Split bundles by vendor
1 parent 23e2d37 commit 2c49f7b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Servers/UI/OJS.Servers.Ui/ClientApp/vite.config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,25 @@ export default defineConfig({
3030
main: resolve(__dirname, 'index.html'),
3131
admin: resolve(__dirname, 'admin.html')
3232
},
33+
output: {
34+
manualChunks(id) {
35+
if (id.includes('node_modules')) {
36+
if (id.includes('react')) {
37+
return 'react-vendor'; // React and its ecosystem
38+
}
39+
40+
if (id.includes('material')) {
41+
return 'material-vendor'; // Material
42+
}
43+
44+
if (id.includes('@mui')) {
45+
return 'mui-vendor'; // Material UI
46+
}
47+
48+
return 'vendor'; // Other libraries
49+
}
50+
}
51+
},
3352
onwarn(warning, warn) {
3453
if (warning.code === 'MODULE_LEVEL_DIRECTIVE') {
3554
return

0 commit comments

Comments
 (0)