import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; export default defineConfig({ root: __dirname, // Env lives at the workspace root, shared with the backoffice — without this // Vite looks in apps/portal and VITE_BASE_API_URL silently falls back to its // built-in default. envDir: '../../', cacheDir: '../../node_modules/.vite/apps/portal', server: { port: 4200, host: 'localhost' }, // server: { // port: 4200, // proxy: { // '/api': { // target: 'http://localhost:3000', // change from 'https://ema-api-dev.triaplc.com' // changeOrigin: true, // }, // }, // }, preview: { port: 4200, host: 'localhost' }, plugins: [react(), nxViteTsPaths()], resolve: { dedupe: ['react', 'react-dom', 'react-router-dom', '@tanstack/react-query'], }, build: { outDir: '../../dist/apps/portal', emptyOutDir: true, reportCompressedSize: true, }, });