-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathvite.config.js
More file actions
64 lines (63 loc) · 1.72 KB
/
vite.config.js
File metadata and controls
64 lines (63 loc) · 1.72 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
import { defineConfig } from 'vite'
import viteCompression from 'vite-plugin-compression'
export default defineConfig({
root: '.',
base: '/', // Root path for custom domain brainchop.org
plugins: [
// Generate gzip compressed files
viteCompression({
algorithm: 'gzip',
ext: '.gz',
threshold: 1024, // Only compress files larger than 1KB
deleteOriginFile: false
}),
// Generate brotli compressed files (better compression than gzip)
viteCompression({
algorithm: 'brotliCompress',
ext: '.br',
threshold: 1024,
deleteOriginFile: false
})
],
server: {
open: 'index.html'
},
preview: {
port: 8088
},
build: {
target: 'es2015',
minify: 'esbuild',
chunkSizeWarningLimit: 2000, // Increase limit since medical imaging libs are naturally large
rollupOptions: {
output: {
manualChunks(id) {
// Split TensorFlow.js into its own chunk (largest dependency)
if (id.includes('@tensorflow/tfjs')) {
return 'vendor-tf';
}
// NiiVue visualization library
if (id.includes('@niivue/niivue')) {
return 'vendor-niivue';
}
// 3D math utilities
if (id.includes('gl-matrix')) {
return 'vendor-math';
}
// Compression libraries (loaded dynamically when needed)
if (id.includes('blosc') || id.includes('lz4') || id.includes('zstd')) {
return 'vendor-compression';
}
// Other vendor libraries
if (id.includes('node_modules')) {
return 'vendor';
}
}
}
}
},
esbuild: {
treeShaking: true,
drop: ['console', 'debugger']
}
})