Rollup was splitting svelte/src/internal/client/runtime.js into a different chunk from svelte/src/index-client.js, producing ~35 warnings about untrack/tick re-exports leading to broken execution order. Add manualChunks function to vite.config.ts to colocate all svelte node_modules into a single 'svelte-vendor' chunk, keeping runtime.js and index-client.js together.
24 lines
695 B
TypeScript
24 lines
695 B
TypeScript
import { defineConfig } from 'vite';
|
|
import { sveltekit } from '@sveltejs/kit/vite';
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
tailwindcss(),
|
|
sveltekit() // <-- Must come after Tailwind
|
|
],
|
|
build: {
|
|
rollupOptions: {
|
|
output: {
|
|
// Keep all svelte internals in one chunk to prevent circular
|
|
// dependency warnings between runtime.js and index-client.js
|
|
manualChunks(id) {
|
|
if (id.includes('/node_modules/svelte/')) {
|
|
return 'svelte-vendor';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|