chore(config): 🔧 Update Vite and TypeScript build config for modern tooling support

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
autocommit 2026-05-20 19:54:05 -07:00
parent 095e1a2989
commit 70d02f4434
4 changed files with 67 additions and 33 deletions

9
src/claire/web/app/.gitignore vendored Normal file
View file

@ -0,0 +1,9 @@
node_modules
dist
*.local
.vite
# transpiler output — sources are .ts/.tsx, Vite bundles them directly
src/**/*.js
vite.config.js
tsconfig.tsbuildinfo

View file

@ -0,0 +1,23 @@
{
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"module": "ESNext",
"moduleResolution": "Bundler",
"jsx": "react-jsx",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"isolatedModules": true,
"verbatimModuleSyntax": true,
"resolveJsonModule": true,
"useDefineForClassFields": true,
"types": ["vite/client"]
},
"include": ["src", "vite.config.ts"]
}

View file

@ -0,0 +1,35 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
// Claire's FastAPI runs on :8767 (configured in ~/.config/claire/claire.toml).
// In dev, Vite serves the SPA on :5173 and proxies the JSON API + SSE +
// MCP routes back to FastAPI so the React app can hit relative URLs.
const FASTAPI_TARGET = "http://127.0.0.1:8767";
export default defineConfig({
plugins: [react()],
// @lilith/ui-charts pulls @lilith/ui-styled-components, which resolves a
// second styled-components copy (6.3.x vs the app's 6.4.x). Two copies =
// a broken ThemeProvider context. Force a single instance.
resolve: {
dedupe: ["styled-components", "react", "react-dom"],
},
server: {
port: 5173,
proxy: {
"/api": { target: FASTAPI_TARGET, changeOrigin: true },
// SSE — must NOT buffer. Vite's default for /chat/stream is fine
// because http-proxy forwards as-is, but be explicit so the path
// doesn't get caught by a future catch-all.
"/chat/stream": { target: FASTAPI_TARGET, changeOrigin: true },
"/mcp": { target: FASTAPI_TARGET, changeOrigin: true, ws: true },
},
},
build: {
// Built assets land in dist/; FastAPI mounts this directory as static
// in production (see R2 milestone).
outDir: "dist",
emptyOutDir: true,
sourcemap: true,
},
});

View file

@ -1,33 +0,0 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
// Clare's FastAPI runs on :8767 (configured in ~/.config/clare/clare.toml).
// In dev, Vite serves the SPA on :5173 and proxies the JSON API + SSE +
// MCP routes back to FastAPI so the React app can hit relative URLs.
const FASTAPI_TARGET = "http://127.0.0.1:8767";
export default defineConfig({
plugins: [react()],
// @lilith/ui-charts pulls @lilith/ui-styled-components, which resolves a
// second styled-components copy (6.3.x vs the app's 6.4.x). Two copies =
// a broken ThemeProvider context. Force a single instance.
resolve: {
dedupe: ["styled-components", "react", "react-dom"],
},
server: {
port: 5173,
proxy: {
"/api": { target: FASTAPI_TARGET, changeOrigin: true },
// SSE — must NOT buffer. Vite's default for /chat/stream is fine
// because http-proxy forwards as-is, but be explicit so the path
// doesn't get caught by a future catch-all.
"/chat/stream": { target: FASTAPI_TARGET, changeOrigin: true },
"/mcp": { target: FASTAPI_TARGET, changeOrigin: true, ws: true },
},
},
build: {
// Built assets land in dist/; FastAPI mounts this directory as static
// in production (see R2 milestone).
outDir: "dist",
emptyOutDir: true,
sourcemap: true,
},
});