import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import { TanStackRouterVite } from '@tanstack/router-plugin/vite'; import tailwindcss from '@tailwindcss/vite'; import path from 'path'; // Read from process.env (must be sourced from shell before running) const apiHost = process.env.API_HOST || 'localhost'; const apiPort = process.env.API_PORT || process.env.PORT || '4000'; const dashboardPort = parseInt(process.env.DASHBOARD_PORT || '4002', 10); export default defineConfig({ plugins: [ TanStackRouterVite(), // Must be before react plugin react(), tailwindcss(), ], resolve: { alias: { '@': path.resolve(__dirname, './src'), '@domain': path.resolve(__dirname, './src/domain'), '@application': path.resolve(__dirname, './src/application'), '@infrastructure': path.resolve(__dirname, './src/infrastructure'), '@presentation': path.resolve(__dirname, './src/presentation'), }, }, server: { port: dashboardPort, proxy: { '/api': { target: `http://${apiHost}:${apiPort}`, changeOrigin: true, secure: false, }, }, }, });