blob: 6f8126d7d0345600c61ddd99cc56ea2d10270028 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
const backendPort = env.PORT ?? '3001';
const backendTarget =
env.VITE_API_PROXY_TARGET ?? `http://localhost:${backendPort}`;
return {
plugins: [react()],
server: {
proxy: {
'/api': {
target: backendTarget,
changeOrigin: true,
secure: false,
},
},
},
};
});
|