-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
37 lines (36 loc) · 1005 Bytes
/
vite.config.js
File metadata and controls
37 lines (36 loc) · 1005 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
32
33
34
35
36
37
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [react()],
base: '/',
test: {
environment: 'jsdom',
globals: true,
setupFiles: ['./src/test-setup.js'],
},
build: {
sourcemap: false,
chunkSizeWarningLimit: 600,
minify: 'terser',
terserOptions: {
compress: {
drop_debugger: true, // strip debugger statements
passes: 2, // two compression passes for better ratio
},
format: {
comments: false, // strip all comments from output
},
},
rollupOptions: {
output: {
manualChunks(id) {
// React + ReactDOM into a stable vendor chunk — browsers cache it
// independently from app code, which changes more frequently.
if (id.includes('node_modules/react/') || id.includes('node_modules/react-dom/')) {
return 'react-vendor';
}
},
},
},
},
});