Files
clawstor/dashboard-v2/vite.config.ts
T
osobhandClaude Sonnet 5 334cd068d2
Build with clawstor cache / Cargo build (clawstor-cached) (pull_request) Failing after 6s
dashboard-v2: fix asset base path to match backend /v2 mount
Console errors on the live dashboard (architect:7700) turned out to
be two separate problems layered together:

1. The deployed static bundle wasn't built from this repo at all --
   it called /api/v2/hot-refs, /api/v2/anomalies, and
   /api/v2/node/*/metrics-history, none of which exist anywhere in
   this codebase on any branch (checked via `git log --all -S`).
   Someone built and shipped a frontend straight to
   /usr/share/claw-store/v2 without ever committing the source.

2. Separately, this repo's own committed vite.config.ts had a latent
   bug: `base: '/clawstor/'`, contradicting its own comment ("served
   by claw-store serve under /v2/*") and the actual backend mount in
   serve.rs (`nest_service("/v2", ...)`). Checked `tailscale serve
   status` on tank + architect -- neither has ever proxied a
   /clawstor path, so that base would have 404'd every asset the
   moment anyone rebuilt and redeployed from source.

Fix: base = '/v2/', matching the real mount. Rebuilt and redeployed
to tank + architect (orphaned build backed up to
/usr/share/claw-store/v2.bak-orphaned on both).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-07-31 13:16:53 -07:00

33 lines
1.1 KiB
TypeScript

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
// dashboard-v2 → served by `claw-store serve` under /v2/*.
// Base path lines up with the cutover plan in docs/dashboard-v2.md.
// During local dev the daemon proxies /api/v2/* on :7700 so
// `vite dev` on :5173 can hit it via server.proxy.
export default defineConfig({
// Absolute base matching the backend's actual mount point
// (`serve.rs` nests the v2 static dir at `/v2` via
// `nest_service("/v2", …)`). A prior `/clawstor/` base assumed a
// Tailscale Serve path mapping that was never actually configured
// on any node (checked `tailscale serve status` on tank +
// architect: neither proxies a `/clawstor` path) — that base
// silently broke direct `:7700/v2/` access, the only access
// pattern that's actually live.
base: '/v2/',
plugins: [react()],
server: {
port: 5173,
proxy: {
'/api/v2': {
target: 'http://127.0.0.1:7700',
changeOrigin: true,
},
},
},
build: {
outDir: 'dist',
emptyOutDir: true,
},
});