Files
meshcore-hub/vite.config.ts
Louis King a5fabf7d46 chore(web): remove lit-html fallback & legacy code — Phase 4
The React frontend is complete (Phases 1-3); the lit-html fallback is dead
(its vendor globals were removed in Phase 3). Delete it and the scaffolding:

- Delete the entire src/meshcore_hub/web/static/js/spa/ lit-html tree,
  LitBridge.tsx, and legacy.d.ts.
- Remove the @legacy alias from vite.config.ts and tsconfig.json.
- Remove lit-html and qrcodejs from package.json (both unused now).
- Remove the lit-html fallback {% else %} branch from spa.html — the Vite
  build is now required to serve the UI (no fallback bundle).

Tests (fallback no longer exists):
- test_home/advertisements/nodes/messages.py: assert the React mount point
  (id="app") instead of a bundled-or-fallback script tag.
- test_caching.py: JS-cache tests are header-only (static JS is bundled into
  dist/, absent in test env; the middleware sets headers on 404 too); the
  dist-bundle HTML test drops its fallback branch.

Docs:
- AGENTS.md: new Frontend (React) section (host-run npm/vite/tsc toolchain,
  react-chartjs-2/react-leaflet/react-qr-code, CSS load order); clarified the
  compose-stack rule to exempt frontend tooling.
- REACT_MIGRATION.md: Phase 4 complete, final file structure, decisions.

Verified: tsc --noEmit clean, npm run build, full pytest (1463 passed,
22 skipped), pre-commit (passed).
2026-07-21 19:13:01 +01:00

34 lines
769 B
TypeScript

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { resolve } from "node:path";
const SPA_REACT = resolve(
__dirname,
"src/meshcore_hub/web/static/js/spa-react",
);
const DIST = resolve(__dirname, "src/meshcore_hub/web/static/dist");
export default defineConfig({
base: "/static/dist/",
plugins: [react()],
resolve: {
alias: {
"@": SPA_REACT,
},
},
build: {
outDir: DIST,
emptyOutDir: true,
manifest: true,
rollupOptions: {
input: resolve(SPA_REACT, "index.html"),
output: {
manualChunks: {
vendor: ["react", "react-dom", "react-router"],
i18n: ["i18next", "react-i18next", "i18next-browser-languagedetector"],
},
},
},
},
});