vite.config.ts
622 Bytes
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
// dev_port (frontend.dev_port) = 5173;后端 http_port (backend.http_port) = 5172(D2)
// /api 经 Vite dev proxy 转发到后端,避免跨端口 CORS。
export default defineConfig({
plugins: [react()],
server: {
port: 5173,
proxy: {
'/api': {
target: 'http://localhost:5172',
changeOrigin: true,
},
},
},
test: {
environment: 'jsdom',
globals: true,
setupFiles: ['./tests/setup.ts'],
css: true,
include: ['tests/unit/**/*.{test,spec}.{ts,tsx}'],
},
});