import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import { fileURLToPath, URL } from 'node:url' // Dev: proxy /api and /v1 to the Go backend so the browser stays same-origin // (no CORS, and the HttpOnly refresh cookie flows through the proxy). const backend = process.env.VITE_PROXY_TARGET || 'http://localhost:18080' export default defineConfig({ plugins: [vue()], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)), }, }, server: { port: 5173, proxy: { '/api': { target: backend, changeOrigin: true }, '/v1': { target: backend, changeOrigin: true }, }, }, preview: { host: true, // bind 0.0.0.0 so the built SPA is reachable over the public IP port: 5173, proxy: { '/api': { target: backend, changeOrigin: true }, '/v1': { target: backend, changeOrigin: true }, }, }, })