-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathvite.config.ts
More file actions
67 lines (66 loc) · 2.33 KB
/
vite.config.ts
File metadata and controls
67 lines (66 loc) · 2.33 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
67
import { defineConfig } from 'vite';
import preact from '@preact/preset-vite';
import mdx from '@mdx-js/rollup';
import tailwindcss from '@tailwindcss/vite'
import { unifiedMdxPreprocessor } from './src/plugins/unified-mdx-plugin';
import { llmTxtGenerator } from './src/plugins/llm-txt-generator';
import { llmTxtDevServer } from './src/plugins/llm-txt-dev-server';
import { frontmatterGenerator } from './src/plugins/frontmatter-generator';
import { frontmatterDevServer } from './src/plugins/frontmatter-dev-server';
import { docsAssetsPlugin } from './src/plugins/docs-assets';
import { htmlMetadataInjector } from './src/plugins/html-metadata-injector';
import { htmlFilesMiddleware } from './src/plugins/html-files-middleware';
import { analyticsInjector } from './src/plugins/analytics-injector';
import { sitemapGenerator } from './src/plugins/sitemap-generator';
import { robotsGenerator } from './src/plugins/robots-generator';
import { prerender } from './src/plugins/prerender';
import { getMdxConfig } from './src/config/mdx';
export default defineConfig(({ command }) => ({
plugins: [
// SINGLE SOURCE OF TRUTH: All MDX preprocessing happens in src/mdx/processor.ts
htmlFilesMiddleware(), // Must be first to intercept HTML file requests
unifiedMdxPreprocessor(),
preact(),
mdx(getMdxConfig(command === 'serve')),
tailwindcss(),
llmTxtGenerator(),
llmTxtDevServer(),
frontmatterGenerator(),
frontmatterDevServer(),
docsAssetsPlugin(),
htmlMetadataInjector(),
analyticsInjector(),
sitemapGenerator(),
robotsGenerator(),
prerender(),
],
resolve: {
dedupe: ['preact', 'preact/compat', 'preact/hooks', 'preact/jsx-runtime', 'preact/compat/jsx-runtime'],
alias: {
react: 'preact/compat',
'react-dom': 'preact/compat',
}
},
publicDir: false, // Don't use a public directory since we need to import from docs
build: {
rollupOptions: {
output: {
manualChunks: {
'vendor-preact': ['preact', 'preact/compat', 'preact/hooks'],
'vendor-ui': ['@clidey/ux', '@headlessui/react'],
'vendor-icons': ['lucide-react'],
'katex': ['katex'],
'flexsearch': ['flexsearch'],
}
}
}
},
server: {
allowedHosts: true,
port: 3000,
strictPort: false,
},
json: {
stringify: false
},
}));