42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import { defineConfig } from 'vite'
|
|
|
|
export default defineConfig({
|
|
plugins: [vue(), tailwindcss()],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
},
|
|
},
|
|
// noVNC 1.7 使用 top-level await,需较新的构建目标(现代浏览器均支持);
|
|
// 生产构建与 dev 依赖预构建(esbuild)都要提高 target,否则 dev 会报同一错误
|
|
build: {
|
|
target: 'es2022',
|
|
},
|
|
optimizeDeps: {
|
|
esbuildOptions: {
|
|
target: 'es2022',
|
|
},
|
|
},
|
|
server: {
|
|
port: 5173,
|
|
host: '127.0.0.1',
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:8080',
|
|
changeOrigin: true,
|
|
ws: true,
|
|
},
|
|
// 只代理网关端点 /ai/*;裸 '/ai' 前缀会误拦 /ai-gateway 页面路由
|
|
'^/ai/': {
|
|
target: 'http://localhost:8080',
|
|
changeOrigin: true,
|
|
ws: true,
|
|
},
|
|
},
|
|
},
|
|
})
|