Files
open-design/vite.config.ts
T
pftom a98096a042 Add initial project structure with essential files
- Created .gitignore to exclude build artifacts and dependencies.
- Added index.html as the main entry point for the application.
- Included LICENSE file with Apache 2.0 terms.
- Initialized package.json and package-lock.json for project dependencies.
- Added pnpm-lock.yaml for package management.
- Created QUICKSTART.md for setup instructions.
- Added README.md and README.zh-CN.md for project documentation in English and Chinese.
2026-04-28 12:25:59 +08:00

35 lines
1005 B
TypeScript

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
const DAEMON_PORT = Number(process.env.OCD_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,
},
},
},
});