import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import path from 'node:path'; const apiPort = Number(process.env.TALLYNOTE_PORT ?? 3000); export default defineConfig({ root: 'web-next', plugins: [react()], resolve: { alias: { '@': path.resolve(process.cwd(), 'web-next/src') }, }, server: { host: '127.0.0.1', port: 5173, proxy: { '/api': { target: `http://127.0.0.1:${apiPort}`, // Preserve the browser Origin so Fastify can validate the configured // public origin and its explicit development origins. changeOrigin: false, }, '/health': { target: `http://127.0.0.1:${apiPort}`, changeOrigin: false, }, }, }, build: { outDir: '../dist/web', emptyOutDir: true, cssCodeSplit: true, sourcemap: false, }, });