Files
mgmt/frontend/vite.config.ts
Scott Hatlen (CTR) 0dd4697020 loading env explicitly
2026-03-17 09:43:00 -07:00

32 lines
940 B
TypeScript

import path from "path"
import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig(({ mode }) => {
// Load env file from current directory, including those from process.env
const env = loadEnv(mode, process.cwd(), '');
// Prioritize the Docker-injected API_TARGET, fallback to local for dev
const apiTarget = env.API_TARGET || 'http://localhost:5001';
return {
plugins: [react(), tailwindcss()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
server: {
host: true, // Needed for Docker to expose the port
proxy: {
'/api': {
target: apiTarget,
changeOrigin: true,
// If your Flask backend doesn't expect /api prefix, add rewrite:
// rewrite: (path) => path.replace(/^\/api/, '')
},
},
},
};
})