vite.config.js 432 B

12345678910111213141516
  1. import { defineConfig } from 'vite'
  2. import react from '@vitejs/plugin-react'
  3. // 构建产物挂在 FastAPI 的 /app/ 下(base 必须对齐)。
  4. // dev 时把正式 API 请求代理到本地 uvicorn,省去跨域。
  5. export default defineConfig({
  6. base: '/app/',
  7. plugins: [react()],
  8. build: { outDir: 'dist', emptyOutDir: true },
  9. server: {
  10. port: 5180,
  11. proxy: {
  12. '/api': 'http://127.0.0.1:8126',
  13. },
  14. },
  15. })