-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
61 lines (56 loc) · 1.6 KB
/
vite.config.ts
File metadata and controls
61 lines (56 loc) · 1.6 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
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import path from "path";
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
// Determine base path based on environment
let basePath = "/";
const isAitDeployment = process.env.DEPLOY_TARGET === 'ait';
if (mode === 'production') {
// Check if building for AIT server or GitHub Pages
if (isAitDeployment) {
basePath = "/";
} else {
// Default to GitHub Pages
basePath = "/Center-for-Nexus-of-Air-Quality-Health-Ecosystem-and-Climate/";
}
}
return {
server: {
host: true,
port: 5173,
strictPort: true,
watch: {
usePolling: true,
},
},
plugins: [react()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
// Use dynamic base path based on deployment target
base: basePath,
// Define environment variables for runtime
define: {
'import.meta.env.VITE_DEPLOY_TARGET': JSON.stringify(process.env.DEPLOY_TARGET || 'github'),
},
// Build optimizations
build: {
rollupOptions: {
output: {
manualChunks: {
// Split vendor libraries
vendor: ['react', 'react-dom'],
ui: ['@radix-ui/react-dialog', '@radix-ui/react-dropdown-menu', '@radix-ui/react-tabs'],
animation: ['framer-motion'],
router: ['react-router-dom'],
supabase: ['@supabase/supabase-js'],
},
},
},
chunkSizeWarningLimit: 1000, // Increase limit to 1000kb
},
};
});