-
Notifications
You must be signed in to change notification settings - Fork 160
Expand file tree
/
Copy pathvite.config.ts
More file actions
97 lines (88 loc) · 3.02 KB
/
Copy pathvite.config.ts
File metadata and controls
97 lines (88 loc) · 3.02 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import path from 'path';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig(() => {
return {
server: {
port: 3000,
host: '0.0.0.0',
},
plugins: [react()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
base: './',
build: {
chunkSizeWarningLimit: 900,
modulePreload: false,
rollupOptions: {
output: {
manualChunks(id) {
// Collapse the per-SVG `?url` lazy stubs (1600+ icons) into a small
// number of bucketed chunks, one per provider pack. Without this,
// Vite emits one tiny JS module per icon and Cloudflare Pages
// upload chokes on the file count.
if (id.includes('/assets/third-party-icons/') && id.includes('.svg')) {
const match = id.match(/assets\/third-party-icons\/([^/]+)\//);
return match ? `icon-urls-${match[1]}` : 'icon-urls';
}
if (!id.includes('node_modules')) {
return undefined;
}
if (id.includes('/node_modules/reactflow/')) {
return 'vendor-reactflow';
}
if (id.includes('/node_modules/elkjs/')) {
// Split the in-process fallback (elk.bundled) from the worker-mode API
// so production loads only the small api shim; the bundled engine is
// fetched only when the worker path is unavailable.
if (id.includes('elk.bundled')) return 'vendor-elk-bundled';
return 'vendor-elk';
}
if (
id.includes('/node_modules/react-markdown/') ||
id.includes('/node_modules/remark-gfm/') ||
id.includes('/node_modules/remark-breaks/') ||
id.includes('/node_modules/rehype-slug/') ||
id.includes('/node_modules/react-syntax-highlighter/')
) {
return 'vendor-markdown';
}
if (
id.includes('/node_modules/i18next') ||
id.includes('/node_modules/react-i18next/')
) {
return 'vendor-i18n';
}
if (id.includes('/node_modules/lucide-react/')) {
return 'vendor-lucide';
}
if (id.includes('/node_modules/framer-motion/')) {
return 'vendor-motion';
}
if (id.includes('/node_modules/@google/genai/')) {
return 'vendor-ai';
}
return undefined;
},
},
},
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: './vitest.setup.ts',
testTimeout: 10000,
maxWorkers: 2,
exclude: ['e2e/**', 'node_modules/**', 'dist/**', 'mcp-server/**'],
coverage: {
provider: 'v8',
reporter: ['text', 'lcov'],
include: ['src/**/*.{ts,tsx}'],
exclude: ['src/**/*.test.{ts,tsx}', 'src/**/*.d.ts', 'src/i18n/**'],
},
},
};
});