Files
CompanyRegister/frontend/vite.config.ts
2026-01-28 23:56:33 +08:00

26 lines
620 B
TypeScript

import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
const proxyTarget = env.VITE_PROXY_TARGET || 'http://localhost:8080';
return {
plugins: [react()],
server: {
proxy: {
'/api/v1': {
target: proxyTarget,
changeOrigin: true,
secure: false,
configure: (proxy) => {
proxy.on('proxyReq', (proxyReq) => {
proxyReq.removeHeader('origin');
});
},
},
},
},
};
});