attempt to optimize vite bundling
This commit is contained in:
@@ -3,5 +3,40 @@ import { sveltekit } from '@sveltejs/kit/vite';
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [tailwindcss(), sveltekit()]
|
plugins: [tailwindcss(), sveltekit()],
|
||||||
|
optimizeDeps: {
|
||||||
|
// Pre-bundle heavy deps to avoid dev slowdowns
|
||||||
|
include: [
|
||||||
|
'libphonenumber-js',
|
||||||
|
'country-state-city',
|
||||||
|
'phosphor-svelte',
|
||||||
|
'@internationalized/date'
|
||||||
|
],
|
||||||
|
// Exclude problematic deps from pre-bundling
|
||||||
|
exclude: ['moment']
|
||||||
|
},
|
||||||
|
build: {
|
||||||
|
rollupOptions: {
|
||||||
|
output: {
|
||||||
|
manualChunks(id) {
|
||||||
|
// Split heavy phone/location libraries
|
||||||
|
if (id.includes('libphonenumber-js') || id.includes('country-state-city')) {
|
||||||
|
return 'vendor-phone';
|
||||||
|
}
|
||||||
|
// Split Phosphor icons (likely heavy)
|
||||||
|
if (id.includes('phosphor-svelte')) {
|
||||||
|
return 'vendor-icons';
|
||||||
|
}
|
||||||
|
// Split moment if used
|
||||||
|
if (id.includes('moment')) {
|
||||||
|
return 'vendor-date';
|
||||||
|
}
|
||||||
|
// Group other vendor libraries
|
||||||
|
if (id.includes('node_modules')) {
|
||||||
|
return 'vendor';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user