Files
clawstor/dashboard-v2/vite.config.ts
T
Omar Sobh 0231b2bb65
Build with clawstor cache / Cargo build (clawstor-cached) (pull_request) Failing after 3s
dashboard-v2 fix: vite base = /clawstor/ (absolute)
Prior ./ (fully-relative) fix broke when browser hit /clawstor
without trailing slash — ./assets/… resolved to /assets/… at
tailnet root, 404. Absolute /clawstor/ is deploy-path-coupled
but no-slash-safe. Verified: no-slash HTML 200, CSS 200,
JS 200, /clawstor/api/v2/fleet 200.
2026-07-14 16:33:23 -07:00

31 lines
961 B
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 tied to the deploy path. Prior try was `./`
// (fully relative) which broke when the user hit `/clawstor`
// without trailing slash — browser resolves `./assets/…`
// against `/clawstor` treated as a file, gives `/assets/…`,
// 404 from Tailscale. Absolute `/clawstor/` sidesteps the
// slash / no-slash ambiguity.
base: '/clawstor/',
plugins: [react()],
server: {
port: 5173,
proxy: {
'/api/v2': {
target: 'http://127.0.0.1:7700',
changeOrigin: true,
},
},
},
build: {
outDir: 'dist',
emptyOutDir: true,
},
});