-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
30 lines (28 loc) · 808 Bytes
/
vite.config.js
File metadata and controls
30 lines (28 loc) · 808 Bytes
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
import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react-swc'
// https://vite.dev/config/
export default defineConfig(({ command, mode }) => {
// Load env file based on current mode
const env = loadEnv(mode, process.cwd(), '');
return {
plugins: [react()],
// 1. Ensure assets are linked from the root
base: '/',
build: {
// 2. Explicitly set output directory for Vercel
outDir: 'dist',
// 3. Clear existing files before building
emptyOutDir: true,
},
server: {
proxy: {
// Forward all API calls to backend; all routes now under /api
'/api': {
target: env.VITE_BACKEND_URL || 'http://localhost:3000',
changeOrigin: true,
secure: false,
},
},
}
}
})