-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
72 lines (70 loc) · 1.79 KB
/
vite.config.ts
File metadata and controls
72 lines (70 loc) · 1.79 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
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import devtoolsJson from 'vite-plugin-devtools-json';
import tailwindcss from '@tailwindcss/vite';
export default defineConfig(({ mode }) => ({
plugins: [tailwindcss(), sveltekit(), devtoolsJson()],
define: {
global: 'globalThis'
},
server: {
fs: {
allow: ['..']
}
},
build: {
rollupOptions: {
output: {
manualChunks: (id) => {
// Node modules get separate vendor chunks based on size
if (id.includes('node_modules')) {
// Large packages get their own chunks
if (id.includes('svelte')) {
return 'svelte-vendor';
}
if (id.includes('@sveltejs/kit')) {
return 'sveltekit-vendor';
}
// Shiki gets its own chunk (much smaller than Monaco)
if (id.includes('shiki')) {
return 'shiki';
}
// Group smaller vendor packages
return 'vendor';
}
// Don't separate components - let them bundle with routes to avoid circular deps
// Routes naturally split at page boundaries via SvelteKit
}
},
onwarn(warning, warn) {
// Suppress sourcemap warnings for specific files
if (
warning.code === 'MISSING_SOURCEMAP_SOURCE' &&
warning.message.includes('node_modules/marked/lib/marked.umd.js')
) {
return;
}
// Use default warning handler for other warnings
warn(warning);
}
},
// Use Terser for better compression in production
minify: 'terser',
terserOptions: {
compress: {
drop_console: mode === 'production',
drop_debugger: mode === 'production',
pure_funcs:
mode === 'production'
? ['console.log', 'console.info', 'console.debug', 'console.warn']
: []
},
mangle: {
safari10: true
},
format: {
comments: false
}
}
}
}));