This repository has been archived on 2026-08-04. You can view files and clone it, but cannot push or open issues or pull requests.
orchestrator/agent-team/web/vite.config.ts
Adam Moussa b16fbd1aaf fix(agent-team-web): scope vitest to src/ so it skips the Playwright e2e specs
ci-web's `test` (vitest run) globbed e2e/dashboard.smoke.spec.ts, which imports
@playwright/test (the Playwright runner, not vitest) and fails to load — "1 test
file failed" while the 44 unit tests passed. Restrict vitest's include to
src/**; Playwright keeps its own testDir (./e2e).
2026-06-25 10:56:48 -04:00

70 lines
2.4 KiB
TypeScript

/// <reference types="vitest/config" />
import { fileURLToPath, URL } from "node:url";
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
// The SPA is served by the FastAPI dashboard (agent_team/dashboard.py) from
// web/dist at LAN :8770. In dev, proxy /api to a locally running dashboard so
// `npm run dev` talks to real data without CORS. No CDN — everything bundles
// locally (the dashboard is offline/LAN-only).
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
build: {
outDir: "dist",
emptyOutDir: true,
sourcemap: false,
rollupOptions: {
output: {
// Split heavy vendors into their own chunks so the app/UI code isn't
// re-downloaded when only a component changes, and to clear the 500 kB
// single-chunk warning. Function form (not object) so react-dom and
// transitive deps bucket precisely instead of collapsing into a stub.
manualChunks(id) {
if (!id.includes("node_modules")) return;
if (/[\\/]node_modules[\\/](react|react-dom|scheduler)[\\/]/.test(id))
return "react";
if (id.includes("reactflow") || id.includes("dagre")) return "flow";
if (id.includes("@radix-ui")) return "radix";
if (
id.includes("react-markdown") ||
id.includes("micromark") ||
id.includes("mdast") ||
id.includes("hast") ||
id.includes("unist") ||
id.includes("unified") ||
id.includes("remark") ||
id.includes("vfile") ||
id.includes("property-information") ||
id.includes("/decode-named-character-reference/") ||
id.includes("character-entities")
)
return "markdown";
return "vendor";
},
},
},
},
server: {
proxy: {
"/api": {
target: process.env.AGENT_TEAM_DASH || "http://127.0.0.1:8770",
changeOrigin: true,
},
},
},
test: {
globals: true,
environment: "jsdom",
setupFiles: ["./src/test/setup.ts"],
css: false,
// Unit tests live under src/. Scope vitest there so it does NOT pick up the
// Playwright e2e specs in e2e/ (they import @playwright/test — the Playwright
// runner, not vitest — and fail to load under `vitest run`).
include: ["src/**/*.{test,spec}.{ts,tsx}"],
},
});