Files
ccp/web/vite.config.ts
adamfandClaude Opus 5.5 0be97384fa
Test and publish / test (push) Successful in 1m28s
Test and publish / publish (push) Successful in 3m30s
Move the dashboard and setup pages to a Vue SPA
The pages are now a Vue 3 + Vite + TypeScript app in web/, built into
internal/web/dist/app and embedded in the binary. Go still serves
index.html for / and /setup behind the admin gate, plus the hashed
/assets/* (public, cached forever). The router takes its base from the
current URL, so it works under nginx's /tracker/ prefix unchanged.

Only dist/.gitkeep is committed, so go build and go test need no Node;
an unbuilt binary shows a "run make web" page at /. The Dockerfile gains
a Node stage, CI typechecks and builds the app, and make build/run build
it first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 22:06:41 +01:00

23 lines
678 B
TypeScript

import { fileURLToPath } from "node:url";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
// The build is embedded in the Go binary (internal/web/dist/app) and served under
// whatever prefix the proxy gives it (/tracker/ in production), so every asset
// URL is relative.
export default defineConfig({
plugins: [vue()],
base: "./",
build: {
outDir: fileURLToPath(new URL("../internal/web/dist/app", import.meta.url)),
emptyOutDir: true,
},
server: {
// `make run` serves the API on :8080 with AUTH_MODE=dev.
proxy: {
"/api": "http://localhost:8080",
"/tracker.user.js": "http://localhost:8080",
},
},
});