import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'

// Dev: Vite serves the UI on :5173 and proxies /api to the Go backend on :8080.
// Prod: `vite build` emits web/dist, which the Go binary embeds and serves itself.
export default defineConfig({
  plugins: [react(), tailwindcss()],
  server: {
    port: 5173,
    proxy: {
      '/api': 'http://localhost:8080',
    },
  },
  build: {
    outDir: 'dist',
    // Keep false so the committed dist/.gitkeep placeholder survives builds —
    // it's what lets `go build` compile on a fresh clone before any frontend build.
    emptyOutDir: false,
  },
})
