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

// In dev, proxy the API + uploads to the Express server so the SPA stays
// same-origin (cookies work) and matches the production setup where Express
// serves the built client.
export default defineConfig({
  plugins: [react()],
  server: {
    port: 5173,
    proxy: {
      '/api': { target: 'http://127.0.0.1:3000', changeOrigin: true },
      '/uploads': { target: 'http://127.0.0.1:3000', changeOrigin: true },
    },
  },
  build: {
    outDir: 'dist',
  },
})
