File size: 973 Bytes
af1bee9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import tailwindcss from '@tailwindcss/vite';
import { fileURLToPath, URL } from 'node:url';

// Dev: Vite on 127.0.0.1:5173 proxies /api to the FastAPI backend (FPT_API_TARGET, default 127.0.0.1:8800).
// Prod: `npm run build` -> dist/, served by FastAPI on the same origin (/ = app, /api = API).
const target = process.env.FPT_API_TARGET || 'http://127.0.0.1:8800';

export default defineConfig({
  plugins: [react(), tailwindcss()],
  resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } },
  server: { host: '127.0.0.1', port: 5173, strictPort: true, proxy: { '/api': { target, changeOrigin: false } } },
  build: { outDir: 'dist', sourcemap: false, chunkSizeWarningLimit: 1200 },
  test: { environment: 'jsdom', globals: true, setupFiles: ['src/test/setup.ts'], include: ['src/**/*.test.{ts,tsx}'], css: false },
});