-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
59 lines (58 loc) · 1.9 KB
/
vite.config.ts
File metadata and controls
59 lines (58 loc) · 1.9 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
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
// https://vite.dev/config/
export default defineConfig({
plugins: [react(), tailwindcss()],
base: '/',
build: {
outDir: 'dist',
// Enable code-splitting for better caching & async loading
rollupOptions: {
output: {
manualChunks: (id) => {
// Firebase is the biggest culprit - isolate it
if (id.includes('firebase')) return 'firebase';
// React core
if (id.includes('react-dom') || id.includes('react-router')) return 'react-vendor';
if (id.includes('node_modules/react/')) return 'react-core';
// Heavy vendor libs loaded on-demand
if (id.includes('sweetalert2')) return 'swal';
if (id.includes('react-icons')) return 'icons';
if (id.includes('axios') || id.includes('react-tabs')) return 'vendor';
if (id.includes('framer-motion')) return 'motion';
},
},
},
minify: 'terser',
// Cast to `any` because Vite's bundled types may differ from installed terser types
// We keep the compress settings to drop console/debugger in production builds.
terserOptions: ( {
compress: {
drop_console: true,
drop_debugger: true,
passes: 2, // Multiple passes for better compression
},
} as any ),
chunkSizeWarningLimit: 600,
cssCodeSplit: true,
cssMinify: 'lightningcss',
target: 'esnext', // Modern browsers only for smaller bundles
modulePreload: {
polyfill: false, // Skip polyfill for modern browsers
},
},
server: {
proxy: {
'/api': {
target: 'http://localhost:5000',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
'/new-list': {
target: 'http://localhost:5000',
changeOrigin: true,
},
},
},
})