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

export default defineConfig({
  plugins: [react()],
  server: {
    host: "0.0.0.0",
    port: 5173,
    // 支援透過 https://threads-tool.30cm.net 存取開發伺服器（需反向代理轉發）
    allowedHosts: ["threads-tool.30cm.net", "localhost"],
    // 如果反向代理在 https 並轉發 HMR websocket，請視代理設定調整 hmr
    // hmr: {
    //   host: "threads-tool.30cm.net",
    //   protocol: "wss",
    // },
    proxy: {
      "/api": {
        target: "http://127.0.0.1:8890",
        changeOrigin: true
      }
    }
  }
});
