添加项目文件。
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
// 开发期将相机接口与 SignalR 统一代理到 HardwareWeb,避免跨域配置。
|
||||
const backend = process.env.VITE_BACKEND_URL ?? 'http://localhost:5062'
|
||||
|
||||
const proxy = {
|
||||
'/api': {
|
||||
target: backend,
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/cameraHub': {
|
||||
target: backend,
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
},
|
||||
},
|
||||
server: {
|
||||
host: '127.0.0.1',
|
||||
port: 5173,
|
||||
watch: {
|
||||
// 文档截图等静态资源无需触发 HMR,避免 Windows 文件占用导致 watcher 崩溃。
|
||||
ignored: ['**/docs/**'],
|
||||
},
|
||||
proxy,
|
||||
},
|
||||
preview: {
|
||||
host: '127.0.0.1',
|
||||
port: 4173,
|
||||
proxy,
|
||||
},
|
||||
build: {
|
||||
outDir: 'dist',
|
||||
sourcemap: false,
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user