import { sveltekit } from '@sveltejs/kit/vite';
import tailwindcss from '@tailwindcss/vite';
import { defineConfig } from 'vite';

export default defineConfig({
	plugins: [tailwindcss(), sveltekit()],
	server: {
		proxy: {
			'/api': 'http://127.0.0.1:8788',
			'/auth': 'http://127.0.0.1:8788',
			// Backend owns /admin/login (registered before the SPA fallback in
			// src/admin/static.ts). Proxy it in dev so the SPA doesn't re-render
			// its layout on that path and 401-redirect into a returnTo loop.
			'/admin/login': 'http://127.0.0.1:8788',
		},
	},
});
