Files
zeekay 5e30074537 wip: scaffold Vite 8 + React 19 SPA under vite/ — Next.js port blocked
The existing Next.js app (99 pages, 427 next/* imports, 177 files using
next/router, 154 using nextjs-routes types, 105 using getServerSideProps) is
far too coupled to rewrite in one pass. A full migration is ~2–4 weeks of
mechanical work.

This commit adds the scaffold only:

  vite/package.json      — Vite 8 + React 19.2 + wouter, no Next deps
  vite/vite.config.ts    — aliases at ../lib, ../ui, ../configs, … so source
                           migrates file-by-file instead of moving
  vite/tsconfig.json     — mirrors the aliases for TypeScript
  vite/index.html        — security headers as <meta> (was nextjs/headers.js)
  vite/src/main.tsx      — React 19 root bootstrap
  vite/src/env.ts        — runtime envs: window.__envs first, import.meta.env
                           fallback, maps NEXT_PUBLIC_API_HOST → VITE_API_BASE_URL
  vite/src/redirects.ts  — full port of nextjs/redirects.js (69 client rules)
  vite/src/App.tsx       — wouter router with CatchAll redirect resolver
  vite/Dockerfile        — 2-stage → ghcr.io/hanzoai/spa
  vite/LLM.md            — what's done, what's left, how to finish

The production Dockerfile at ../Dockerfile still builds the Next.js app. This
scaffold is independent; nothing in the existing tree is deleted or moved.

See vite/LLM.md for the full migration plan and 9 critical TODOs before this
can replace the Next.js build.
2026-04-19 00:05:37 -07:00

38 lines
1.1 KiB
TypeScript

import react from '@vitejs/plugin-react';
import path from 'node:path';
import { defineConfig } from 'vite';
import svgr from 'vite-plugin-svgr';
// Mirror the Next.js alias root so we can reuse existing source folders as the
// migration progresses. Each alias points at ../<dir>, not vite/src/<dir>.
const aliasRoot = path.resolve(__dirname, '..');
export default defineConfig({
plugins: [ react(), svgr() ],
resolve: {
alias: {
configs: path.join(aliasRoot, 'configs'),
lib: path.join(aliasRoot, 'lib'),
mocks: path.join(aliasRoot, 'mocks'),
nextjs: path.join(aliasRoot, 'nextjs'),
stubs: path.join(aliasRoot, 'stubs'),
toolkit: path.join(aliasRoot, 'toolkit'),
tools: path.join(aliasRoot, 'tools'),
types: path.join(aliasRoot, 'types'),
ui: path.join(aliasRoot, 'ui'),
icons: path.join(aliasRoot, 'icons'),
'public': path.join(aliasRoot, 'public'),
},
},
build: {
outDir: 'dist',
emptyOutDir: true,
target: 'es2022',
sourcemap: false,
},
server: {
port: 3000,
host: '0.0.0.0',
},
});