mirror of
https://github.com/sakaljurgis/best-choice.git
synced 2026-07-08 21:47:40 +00:00
21 lines
519 B
TypeScript
21 lines
519 B
TypeScript
import { defineConfig, loadEnv } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import path from 'node:path';
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const rootDir = path.resolve(__dirname, '..');
|
|
const env = loadEnv(mode, rootDir, '');
|
|
const clientPort = Number(env.CLIENT_PORT) || 5173;
|
|
const proxyTarget = env.API_PROXY_TARGET || 'http://localhost:3000';
|
|
|
|
return {
|
|
plugins: [react()],
|
|
server: {
|
|
port: clientPort,
|
|
proxy: {
|
|
'/api': proxyTarget
|
|
}
|
|
}
|
|
};
|
|
});
|