Vite + TypeScript, no framework. One health board page proves the whole path: fetch /api/health, render per-upstream verdicts. Biome and tsc join the just ci gate; dev mode proxies /api to the daemon. arr-daemon embeds web/dist via include_dir: build.rs runs pnpm when available, accepts ARR_WEB_DIST prebuilt, and falls back to a placeholder only in debug so the node-less CI rust job keeps working. Closes #6 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
30 lines
759 B
TypeScript
30 lines
759 B
TypeScript
import { defineConfig, loadEnv } from "vite";
|
|
|
|
// Dev-mode proxy target: the running daemon. `pnpm dev` gives hot reload while
|
|
// every `/api/*` request goes to a real arr. Override with:
|
|
// ARR_DAEMON_URL=http://other-host:7878 pnpm dev
|
|
const DEFAULT_DAEMON_URL = "http://127.0.0.1:7878";
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd(), "");
|
|
const target = (env.ARR_DAEMON_URL ?? DEFAULT_DAEMON_URL).replace(/\/+$/, "");
|
|
return {
|
|
build: {
|
|
target: "es2022",
|
|
outDir: "dist",
|
|
emptyOutDir: true,
|
|
sourcemap: false,
|
|
},
|
|
server: {
|
|
host: true,
|
|
port: 5173,
|
|
proxy: {
|
|
"/api": {
|
|
target,
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
};
|
|
});
|