Repository navigation
Expand file tree
/
Copy pathvite.config.ts
More file actions
66 lines (64 loc) · 1.74 KB
/
Copy pathvite.config.ts
File metadata and controls
66 lines (64 loc) · 1.74 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { fileURLToPath } from 'node:url';
import react from '@vitejs/plugin-react';
import tailwindcss from '@tailwindcss/vite';
import { tanstackStart } from '@tanstack/react-start/plugin/vite';
import mdx from 'fumadocs-mdx/vite';
import { nitro } from 'nitro/vite';
import { defineConfig } from 'vite';
import { getAllDocEntries } from './scripts/lib/content';
import { siteDefinition } from './config/site.shared';
const docEntries = await getAllDocEntries();
const prerenderDocPages = docEntries.map((doc) => ({
path:
doc.routeSegments.length === 0
? siteDefinition.docsBasePath
: `${siteDefinition.docsBasePath}/${doc.routeSegments.join('/')}`,
}));
const prerenderMarkdownPages = docEntries.map((doc) => ({
path: `${siteDefinition.docsBasePath}/llms.mdx/docs/${[...doc.routeSegments, 'content.md'].join('/')}`,
}));
export default defineConfig({
base: '/docs/',
server: {
port: 3000,
watch: {
ignored: ['**/.output/**', '**/node_modules/.nitro/**'],
usePolling: true,
interval: 1000,
},
},
plugins: [
mdx(await import('./source.config')),
tailwindcss(),
tanstackStart({
spa: {
enabled: true,
prerender: {
enabled: true,
crawlLinks: true,
},
},
pages: [
...prerenderDocPages,
...prerenderMarkdownPages,
{
path: `${siteDefinition.docsBasePath}/api/search`,
},
{
path: `${siteDefinition.docsBasePath}/llms.txt`,
},
{
path: `${siteDefinition.docsBasePath}/llms-full.txt`,
},
],
}),
react(),
nitro(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
tsconfigPaths: true,
},
});