forked from nexu-io/open-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
34 lines (32 loc) · 1004 Bytes
/
Copy pathvite.config.ts
File metadata and controls
34 lines (32 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
const DAEMON_PORT = Number(process.env.OD_PORT) || 7456;
export default defineConfig({
plugins: [react()],
server: {
port: 5173,
proxy: {
'/api': {
target: `http://127.0.0.1:${DAEMON_PORT}`,
changeOrigin: true,
// Daemon uses SSE on /api/chat — disable Vite's buffering.
configure: (proxy) => {
proxy.on('proxyRes', (proxyRes) => {
proxyRes.headers['cache-control'] = 'no-cache, no-transform';
});
},
},
// The daemon serves persisted artifacts and the shared device-frame
// library; proxy them through so the dev SPA can iframe them without
// hitting a different origin.
'/artifacts': {
target: `http://127.0.0.1:${DAEMON_PORT}`,
changeOrigin: true,
},
'/frames': {
target: `http://127.0.0.1:${DAEMON_PORT}`,
changeOrigin: true,
},
},
},
});