-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
82 lines (79 loc) · 2.26 KB
/
vite.config.ts
File metadata and controls
82 lines (79 loc) · 2.26 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
73
74
75
76
77
78
79
80
81
82
import tailwindcss from '@tailwindcss/vite';
import react from '@vitejs/plugin-react';
import {resolve} from 'path';
import {defineConfig} from 'vite';
// https://vite.dev/config/
export default defineConfig({
// Build configuration for better development experience
build: {
// Reduce chunk size warnings threshold to 500KB
chunkSizeWarningLimit: 500,
rollupOptions: {
output: {
// Better chunk splitting to keep files under 500KB
manualChunks: id => {
// UI components
if (id.includes('@radix-ui')) return 'ui';
if (id.includes('react') || id.includes('react-dom')) return 'vendor';
// Split large sprites by size
if (id.includes('sprites/magic.svg')) return 'magic-1';
if (id.includes('sprites/status.svg')) return 'status-1';
// Default chunking
return undefined;
},
},
},
// Generate source maps for debugging
sourcemap: true,
},
// CSS configuration for better development experience
css: {
devSourcemap: true, // Generate CSS source maps in development
},
// Environment variable configuration
envPrefix: ['VITE_', 'SUPABASE_'],
// Optimize dependencies for faster dev server startup
optimizeDeps: {
include: [
'react',
'react-dom',
'react/jsx-runtime',
'@radix-ui/react-slot',
'@radix-ui/react-tabs',
'@radix-ui/react-dialog',
'clsx',
'tailwind-merge',
'tailwind-variants',
'lucide-react',
'vaul',
],
},
plugins: [
react({
// Include .tsx files for JSX processing
include: ['**/*.tsx', '**/*.ts'],
}),
tailwindcss(),
],
resolve: {
alias: {
'@': resolve(process.cwd(), './src'),
},
},
server: {
cors: true,
// Hot Module Replacement (HMR) configuration
hmr: {
overlay: true, // Show error overlay in browser
},
host: true, // Allow external connections
open: false, // Don't auto-open browser (let user decide)
// Development server configuration
port: 5173,
// Watch configuration for better file change detection
watch: {
interval: 100, // Polling interval if usePolling is true
usePolling: false, // Use native file system events (faster)
},
},
});