mirror of
https://github.com/ThisTine/Snip.git
synced 2026-08-18 23:18:47 +07:00
feat: first commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
|
||||
// Minimal ambient declaration so we can read an env override without pulling in
|
||||
// @types/node just for the config file.
|
||||
declare const process: { env: Record<string, string | undefined> };
|
||||
|
||||
// In dev the SPA runs on :5173 while the Go API runs elsewhere (default :8080,
|
||||
// or the compose gateway). Proxy /api so the browser stays same-origin — no
|
||||
// CORS, and the session cookie works. Override the target with VITE_API_PROXY.
|
||||
const apiTarget = process.env.VITE_API_PROXY || "http://localhost:8080";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
server: {
|
||||
host: true,
|
||||
port: 5173,
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: apiTarget,
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user