-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.js
More file actions
67 lines (57 loc) · 1.66 KB
/
Copy pathvite.config.js
File metadata and controls
67 lines (57 loc) · 1.66 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
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()
],
build: {
// Enable minification
minify: 'terser',
terserOptions: {
compress: {
drop_console: true, // Remove console.logs in production
drop_debugger: true,
},
},
// Configure code splitting
rollupOptions: {
output: {
manualChunks: {
// Vendor chunk for React and related libs
'react-vendor': ['react', 'react-dom', 'react-router-dom'],
// Icons as separate chunk
'icons': ['react-icons'],
// Motion library separate
'motion': ['motion'],
// Utilities
'utils': ['react-scroll'],
},
// Optimize chunk loading
chunkFileNames: 'assets/js/[name]-[hash].js',
entryFileNames: 'assets/js/[name]-[hash].js',
assetFileNames: 'assets/[ext]/[name]-[hash].[ext]',
},
},
// Set chunk size warning limit
chunkSizeWarningLimit: 600,
// Enable CSS code splitting
cssCodeSplit: true,
// Source maps for debugging (disable in production for smaller builds)
sourcemap: false,
// Target modern browsers for smaller bundles
target: 'es2015',
},
// Optimize dependencies
optimizeDeps: {
include: ['react', 'react-dom', 'react-router-dom'],
exclude: [],
},
// Performance optimizations
esbuild: {
// Drop console and debugger in production
drop: process.env.NODE_ENV === 'production' ? ['console', 'debugger'] : [],
},
})