import { defineConfig } from 'vite' import { svelte } from '@sveltejs/vite-plugin-svelte' // The backend the dev server proxies to. 127.0.0.1 rather than localhost on // purpose: Node resolves "localhost" to ::1 first, and the Go server binds // IPv4, so the proxy would fail before falling back. const apiTarget = process.env.VELLUM_API ?? 'http://127.0.0.1:7788' // The bundle is embedded into the Go binary and served from /, so all asset // paths must be relative (base: './'). export default defineConfig({ plugins: [svelte()], base: './', build: { outDir: 'dist', emptyOutDir: true, target: 'es2020', }, server: { port: 5173, // Listen on both stacks so a browser using either localhost works. host: true, proxy: { '/api': apiTarget, '/healthz': apiTarget, }, }, })