Files
Havline/web/vite.config.ts
mrlee 302248a907
CI / verify (push) Canceled after 0s
chore(release): 发布 v2.0.0
- 内置 SSH 终端(/terminal):复用已保存的 SSH 密码/私钥与独立 known_hosts 校验
- 终端二次认证、会话审计(/terminal/audits)、录像审计与常用命令
- DDNS 服务商名称与自定义 IP,新增迁移 037/038/039
- CHANGELOG 与 VERSION 更新至 2.0.0
2026-10-16 20:18:04 +08:00

39 lines
1.1 KiB
TypeScript

import { readFileSync } from 'node:fs'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf-8')) as { version: string }
export default defineConfig({
base: process.env.VITE_BASE_PATH || '/',
plugins: [vue()],
define: {
__APP_VERSION__: JSON.stringify(process.env.VITE_APP_VERSION || pkg.version),
},
server: {
port: 5173,
allowedHosts: true,
proxy: {
'/api': {
target: 'http://localhost:6893',
// 内置 SSH 终端走 WebSocket:开发代理必须开 ws,否则升级请求会一直挂起
ws: true,
timeout: 300_000,
proxyTimeout: 300_000,
configure(proxy) {
proxy.on('proxyRes', (proxyRes, req) => {
if (req.url?.includes('/stream')) {
proxyRes.headers['cache-control'] = 'no-cache'
proxyRes.headers['x-accel-buffering'] = 'no'
}
})
},
},
},
},
build: {
outDir: 'dist',
emptyOutDir: true,
},
})