Refactor manual chunking in Vite configuration to improve code clarity and maintainability. The updated logic now checks for 'node_modules' and categorizes dependencies into 'vue-vendor' and 'socket-vendor' chunks accordingly.
This commit is contained in:
@@ -46,9 +46,17 @@ export default defineConfig({
|
|||||||
minify: 'terser',
|
minify: 'terser',
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
output: {
|
output: {
|
||||||
manualChunks: {
|
manualChunks(id) {
|
||||||
'vue-vendor': ['vue', 'vue-router', 'pinia'],
|
if (id.includes('node_modules')) {
|
||||||
'socket-vendor': ['socket.io-client']
|
if (id.includes('vue') || id.includes('vue-router') || id.includes('pinia')) {
|
||||||
|
return 'vue-vendor';
|
||||||
|
}
|
||||||
|
if (id.includes('socket.io-client')) {
|
||||||
|
return 'socket-vendor';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Standard-Chunks Vite überlassen
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user