import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); export default defineConfig({ plugins: [react()], resolve: { alias: { // Permite: import { api } from '@/lib/api' '@': path.resolve(__dirname, './src'), }, }, server: { port: 5173, proxy: { // Redireciona /api/* para o servidor Fastify em desenvolvimento // Elimina problemas de CORS — o browser só fala com localhost:5173 '/api': { target: 'http://localhost:3000', changeOrigin: true, }, '/health': { target: 'http://localhost:3000', changeOrigin: true, }, }, }, });