| 1234567891011121314151617181920212223 |
- import { defineConfig } from 'vite'
- import react from '@vitejs/plugin-react'
- // https://vite.dev/config/
- export default defineConfig({
- plugins: [react()],
- server: {
- proxy: {
- // 代理 WebSocket 同步端点
- '/ws': {
- target: 'http://127.0.0.1:8000',
- ws: true,
- changeOrigin: true,
- },
- // 代理所有 API 请求到 /api 前缀
- '/api': {
- target: 'http://127.0.0.1:8000',
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/api/, ''),
- },
- },
- },
- })
|