import { sveltekit } from '@sveltejs/kit/vite'; import { defineConfig } from 'vite'; // Dev-only proxy: in production Caddy fronts both the dashboard and the // API. During `vite dev` we proxy the API ourselves so the dashboard can // run standalone against a locally-running `picloud` binary. const API_TARGET = process.env.PICLOUD_API ?? 'http://127.0.0.1:18080'; const DEV_PORT = Number(process.env.PICLOUD_DASHBOARD_PORT ?? 5173); export default defineConfig({ plugins: [sveltekit()], server: { port: DEV_PORT, strictPort: true, proxy: { '/api': { target: API_TARGET, changeOrigin: true }, '/healthz': { target: API_TARGET, changeOrigin: true } } } });