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';
                    }
                }
            }
        }
    }
});
