-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
31 lines (30 loc) · 1003 Bytes
/
vite.config.ts
File metadata and controls
31 lines (30 loc) · 1003 Bytes
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
import { defineConfig } from 'vite';
export default defineConfig({
build: {
chunkSizeWarningLimit: 3000,
// Exclude the mermaid chunk from <link rel="modulepreload"> injection.
// Mermaid is loaded lazily (dynamic import) only when a page contains
// mermaid code blocks — preloading it on every page load would negate
// the lazy-loading benefit and add 715 KB (gzip) to the critical path.
modulePreload: {
resolveDependencies(_filename, deps, _context) {
return deps.filter((dep) => !dep.includes('mermaid'));
},
},
rolldownOptions: {
output: {
manualChunks(id) {
if (id.includes('node_modules/mermaid/') || id.includes('node_modules/@mermaid-js/')) {
return 'mermaid';
}
if (id.includes('node_modules/highlight.js/')) {
return 'hljs';
}
if (id.includes('node_modules/katex/')) {
return 'katex';
}
},
},
},
},
});