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

export default defineConfig({
	plugins: [tailwindcss(), sveltekit()],
	server: {
		proxy: {
			// mule-sidecar — file rename + (future) folder mutations and
			// per-user heap sharing. Matched BEFORE `/api/*` so PhotoPrism
			// doesn't swallow these paths.
			'/api/sidecar': {
				target: 'http://localhost:8000',
				changeOrigin: false,
				rewrite: (p) => p
			},
			// PhotoPrism REST + WebSocket.
			'/api': {
				target: 'http://localhost:2342',
				changeOrigin: true,
				ws: true
			}
		}
	}
});
