Files
emaui/apps/backoffice/vite.config.mts
mihretue baea9f2b57 chore(dev): serve the portal on 3000 for the Fayda redirect
The Fayda redirect URI registered for local testing is
http://localhost:3000/callback, matched exactly by the provider, so the portal
has to be the thing listening there. Its dev and preview servers move from 4200
to 3000 and the API moves to 3001.

Every hardcoded fallback to http://localhost:3000/api follows — six copies of
the same default across libs/api, libs/auth, the portal and the backoffice —
otherwise a developer without a .env would have had the app calling itself.

e2e is unaffected: it binds its own ports (3011/4302/4303) explicitly.
2026-08-25 19:04:27 +00:00

56 lines
1.8 KiB
TypeScript

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 portal — without this
// Vite looks in apps/backoffice and VITE_BASE_API_URL silently falls back to
// its built-in default.
envDir: '../../',
cacheDir: '../../node_modules/.vite/apps/backoffice',
server: {
port: 4201,
host: 'localhost',
},
// server: {
// port: 4201,
// proxy: {
// '/api': {
// target: 'http://localhost:3001', // change from 'https://ema-api-dev.triaplc.com'
// changeOrigin: true,
// },
// },
// },
preview: { port: 4201, host: 'localhost' },
plugins: [react(), nxViteTsPaths()],
resolve: {
dedupe: ['react', 'react-dom', 'react-router-dom', '@tanstack/react-query'],
alias: {
// The vendored user-management UI pulls in file-type → token-types,
// which imports `node:buffer`. Point it at the browser polyfill so the
// production build resolves it instead of failing on a Node built-in.
'node:buffer': 'buffer',
},
},
define: {
// `buffer` expects a `global` binding that browsers do not provide.
global: 'globalThis',
},
build: {
outDir: '../../dist/apps/backoffice',
emptyOutDir: true,
reportCompressedSize: true,
},
// Unit tests for the pure helpers behind a screen (formatters, URL state).
// Component tests are deliberately not set up: nothing here renders React,
// so no jsdom environment or setup file is needed.
// test: {
// watch: false,
// globals: true,
// environment: 'node',
// include: ['src/**/*.spec.ts'],
// reporters: ['default'],
// },
});