forked from lehhair/OpenCodeUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
31 lines (27 loc) · 938 Bytes
/
vite.config.ts
File metadata and controls
31 lines (27 loc) · 938 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
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
// https://vite.dev/config/
export default defineConfig({
base: process.env.VITE_BASE_PATH || '/',
plugins: [react(), tailwindcss()],
// Tauri CLI 兼容:不清屏,让 Tauri 的日志能保留在终端
clearScreen: false,
server: {
// Tauri mobile dev 需要通过网络访问 Vite dev server
host: process.env.TAURI_DEV_HOST || false,
// 避免端口冲突
strictPort: true,
// 允许所有域名
allowedHosts: true,
proxy: {
// 开发环境代理 - 将 /api 前缀的请求转发到 OpenCode 后端
// 注意:Tauri 模式下前端直接请求后端(通过 plugin-http),不走此代理
'/api': {
target: 'http://127.0.0.1:4096',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
},
},
})