my harness for niri
1import path from "node:path"
2import { fileURLToPath } from "node:url"
3import { defineConfig, loadEnv } from "vite"
4import react from "@vitejs/plugin-react"
5
6const WEB_DIR = path.dirname(fileURLToPath(import.meta.url))
7const REPO_ROOT = path.resolve(WEB_DIR, "../..")
8
9export default defineConfig(({ mode }) => {
10 const env = loadEnv(mode, REPO_ROOT, "")
11 const backendPort = env.PORT ?? "3000"
12 const backendTarget = env.NIRI_PROXY_TARGET ?? `http://127.0.0.1:${backendPort}`
13
14 return {
15 envDir: REPO_ROOT,
16 plugins: [react()],
17 server: {
18 host: true,
19 proxy: {
20 "/trigger": backendTarget,
21 "/chat": backendTarget,
22 "/status": backendTarget,
23 },
24 },
25 preview: {
26 host: true,
27 },
28 }
29})