20 lines
491 B
JavaScript
20 lines
491 B
JavaScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
|
|
// Cổng backend (AdonisJS) — mặc định 3333 (backend/.env: PORT).
|
|
// Override khi cần: VITE_API_TARGET=http://localhost:8386 npm run dev
|
|
const apiTarget = process.env.VITE_API_TARGET || 'http://localhost:3333';
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
server: {
|
|
port: 5173,
|
|
proxy: {
|
|
'/api': {
|
|
target: apiTarget,
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
});
|