chore: 优化 Vite 热更新配置,支持局域网动态 IP 访问并修复 wss 跨域报错

This commit is contained in:
DXC
2026-03-10 09:59:49 +08:00
parent 1708a8ba79
commit 7536bfd75e

View File

@ -18,6 +18,10 @@ export default defineConfig({
host: '0.0.0.0', host: '0.0.0.0',
port: 5173, port: 5173,
https: true, // ★ [新增] 强制开启 HTTPS否则浏览器会拦截摄像头 https: true, // ★ [新增] 强制开启 HTTPS否则浏览器会拦截摄像头
hmr: {
protocol: 'wss',
clientPort: 5173
},
proxy: { proxy: {
// 拦截所有以 /api 开头的请求 // 拦截所有以 /api 开头的请求
'/api': { '/api': {