-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
56 lines (54 loc) · 1.96 KB
/
vite.config.ts
File metadata and controls
56 lines (54 loc) · 1.96 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
/**
* vite.config.ts
*
* Purpose:
* Configures the Vite build system for the FitFlow application, providing optimized development
* and production build settings. This configuration ensures fast development experience,
* efficient dependency handling, and optimized production output for the React application.
*
* Key Features:
* - React plugin integration for JSX transformation and HMR
* - Dependency optimization with strategic inclusion/exclusion
* - CommonJS module transformation for seamless integration
* - Module deduplication to prevent duplicate React instances
* - Path aliasing for simplified imports and AWS SDK compatibility
*
* Technical Details:
* - Configures React plugin for JSX/TSX transformation and Fast Refresh
* - Pre-bundles common dependencies for faster development startup
* - Excludes Lucide React from pre-bundling to prevent optimization issues
* - Handles mixed ESM/CommonJS modules with transformMixedEsModules
* - Deduplicates React to prevent "invalid hook call" errors
* - Provides AWS SDK compatibility through runtime config aliasing
*
* Integration:
* - Entry point for the Vite build process
* - Referenced during npm scripts (dev, build, preview)
* - Configures bundling behavior for all application assets
* - Works alongside TypeScript and PostCSS configurations
* - Enables HMR for development efficiency
*
* Recent Changes:
* - 2025-03-01: Added comprehensive documentation following project standards
*/
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [react()],
optimizeDeps: {
include: ['react', 'react-dom', 'react-router-dom', '@supabase/supabase-js', 'lodash'],
exclude: ['lucide-react']
},
build: {
commonjsOptions: {
include: [/node_modules/],
transformMixedEsModules: true
}
},
resolve: {
dedupe: ['react', 'react-dom'],
alias: {
'./runtimeConfig': './runtimeConfig.browser'
}
}
});