import tailwindcss from '@tailwindcss/vite' import react from '@vitejs/plugin-react' import { tanstackStart } from '@tanstack/react-start/plugin/vite' import regen from 'regen-ui/vite' import { defineConfig } from 'vite' import { generated } from './plugin.ts' // The admin SPA is built in TanStack Start's SPA mode (no SSR runtime): the // build emits a prerendered `_shell.html` plus content-hashed JS/CSS, which the // `generated()` plugin codegens into an asset map (`src/admin/ui.generated.ts`) // the Hono admin app serves. `base: './'` makes the shell reference assets // relatively so the same artifact works whether the app owns its hostname or is // path-mounted (e.g. under `/admin`); the router `basepath` is derived at // runtime from the served location (see `src/router.tsx`). export default defineConfig({ base: './', plugins: [ tanstackStart({ router: { addExtensions: '.js' }, spa: { enabled: true }, }), // Regen provides the theme; `tailwindPlugin: false` defers to our explicit // `tailwindcss()`. `react()` must come after the Start and Regen plugins. regen({ tailwindPlugin: false }), tailwindcss(), react(), // Must come after `tanstackStart()`: its `buildApp` post handler emits the // asset map once TanStack's prerender has written `_shell.html`. generated(), ], })