2026-08-27 10:09:54 +08:00
|
|
|
import { defineConfig } from 'vite';
|
|
|
|
|
import react from '@vitejs/plugin-react';
|
|
|
|
|
|
2026-08-27 19:50:57 +08:00
|
|
|
// MES(B) 内部 API 与 SSE 直连 :8888;其余 /api 走本地兜底服务 :3001
|
2026-08-27 10:09:54 +08:00
|
|
|
export default defineConfig({
|
|
|
|
|
plugins: [react()],
|
|
|
|
|
server: {
|
|
|
|
|
port: 5173,
|
|
|
|
|
proxy: {
|
2026-08-27 19:50:57 +08:00
|
|
|
'/api/internal': {
|
|
|
|
|
target: 'http://localhost:8888',
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
},
|
|
|
|
|
'/sse': {
|
|
|
|
|
target: 'http://localhost:8888',
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
// SSE 长连接
|
|
|
|
|
configure: (proxy) => {
|
|
|
|
|
proxy.on('proxyReq', (proxyReq) => {
|
|
|
|
|
proxyReq.setHeader('X-Accel-Buffering', 'no');
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-08-27 10:09:54 +08:00
|
|
|
'/api': {
|
|
|
|
|
target: 'http://localhost:3001',
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|