Repository navigation
Expand file tree
/
Copy pathvite.config.ts
More file actions
41 lines (38 loc) · 1.76 KB
/
Copy pathvite.config.ts
File metadata and controls
41 lines (38 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { defineConfig } from 'vite'
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
import viteReact from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import { nitro } from 'nitro/vite'
// Note: we don't use Nitro's `prerender` here because its prerenderer
// runs before TanStack Start's Vite SSR build completes — the routes
// aren't reachable yet at that phase, so every doc URL would 404. The
// post-build `scripts/snapshot.mjs` boots the fully-built server and
// crawls each /documentation/* URL into static HTML; Pagefind then
// indexes those snapshots.
const config = defineConfig({
// Mount under /documentation/ so all client assets are emitted with
// that prefix. The docs container is reverse-proxied by Traefik via
// `Host(packyard.test) && PathPrefix(/documentation)` — without this
// base, the browser requests /assets/* which Traefik routes to the
// website container (which doesn't have those files).
base: '/documentation/',
server: {
// Vite v6+ blocks requests whose Host header isn't in the allowed
// list. The workspace docker stack proxies traffic to this dev
// server with Host: packyard.test, so it must be explicitly
// allowed. `localhost` and `127.0.0.1` cover direct access.
allowedHosts: ['packyard.test', 'localhost', '127.0.0.1'],
},
resolve: { tsconfigPaths: true },
plugins: [
// Nitro `baseURL` tells the runtime the whole app is mounted at
// /documentation/, so its static-asset handler answers requests
// for /documentation/assets/* by reading from `.output/public/assets/*`
// and the SSR catchall doesn't swallow them.
nitro({ baseURL: '/documentation/' }),
tailwindcss(),
tanstackStart(),
viteReact(),
],
})
export default config