diff options
Diffstat (limited to 'web/vite.config.ts')
| -rw-r--r-- | web/vite.config.ts | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/web/vite.config.ts b/web/vite.config.ts new file mode 100644 index 0000000..980f48c --- /dev/null +++ b/web/vite.config.ts @@ -0,0 +1,33 @@ +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, + }, + }, + }, +}); |