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

export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
  build: {
    // Output directly into the Python package so it's included in the wheel
    outDir: "../lib/tribalmind/web/static",
    emptyOutDir: true,
  },
  server: {
    proxy: {
      "/api": {
        target: "http://localhost:7484",
        changeOrigin: true,
      },
    },
  },
  // SPA fallback — all non-asset routes serve index.html
  appType: "spa",
})
