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

// 開發期把資料請求轉發到同目錄的 MacroScope 後端（預設 :3000）
const API_TARGET = process.env.API_TARGET || "http://localhost:3000";

export default defineConfig({
  plugins: [react()],
  server: {
    port: 5173,
    proxy: {
      "/api": { target: API_TARGET, changeOrigin: true },
      "/book-patterns": { target: API_TARGET, changeOrigin: true },
    },
  },
});
