From e08cea9c6af484ec9792ac0a5b2c8edc83d90b91 Mon Sep 17 00:00:00 2001 From: yangsy Date: Wed, 27 May 2026 02:23:13 +0800 Subject: [PATCH] =?UTF-8?q?build(vite=20config):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E6=9C=8D=E5=8A=A1=E5=99=A8=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E4=B8=8E=E7=AB=AF=E5=8F=A3=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将开发服务器端口提取为常量 SERVER_PORT 以简化维护 - 为 API 代理添加环境注释并注释备用后端地址 - 新增本地测试用的 vimp/api 代理配置 - 新增 CDN 代理指向本地开发服务器端口 --- vite.config.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 073b6db..e29e468 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,6 +4,8 @@ import { fileURLToPath, URL } from 'node:url'; import { defineConfig, ProxyOptions } from 'vite'; import vueDevTools from 'vite-plugin-vue-devtools'; +const SERVER_PORT = 9763; + type ProxyItem = { key: string; target: string; @@ -198,7 +200,8 @@ const apiProxyList: ProxyItem[] = [ ...line04ApiProxyList, { key: '/minio', target: 'http://10.18.128.10:9000', rewrite: ['/minio', ''] }, - { key: '/api', target: 'http://10.18.128.10:18760' }, + { key: '/api', target: 'http://10.18.128.10:18760' }, // 吴中路控制中心 + // { key: '/api', target: 'http://10.18.187.10:18760' }, // 紫藤路 { key: '/ws', target: 'ws://10.18.128.10:18103', ws: true }, ...line10ApiProxyList, @@ -207,6 +210,13 @@ const apiProxyList: ProxyItem[] = [ // { key: '/api', target: 'http://10.24.0.10:18760' }, // { key: '/ws', target: 'ws://10.24.0.10:18103', ws: true }, ...line21YangpuTestProxyList, + + // 设备树测试用代理配置 + // { key: '/vimp/api', target: 'http://10.14.0.10:18080', rewrite: ['/vimp/api', '/api'] }, + // { key: '/vimp/api', target: 'http://10.18.128.6:18080', rewrite: ['/vimp/api', '/api'] }, + { key: '/vimp/api', target: 'http://localhost:4000', rewrite: ['/vimp/api', '/api'] }, + // { key: '/vimp/api', target: 'http://10.18.128.6:18080', rewrite: ['/vimp/api', '/api'] }, + { key: '/cdn', target: `http://localhost:${SERVER_PORT}`, rewrite: ['/cdn', ''] }, ]; // https://vite.dev/config/ @@ -232,7 +242,7 @@ export default defineConfig((/* { command, mode } */) => { }, }, server: { - port: 9763, + port: SERVER_PORT, proxy: viteProxy, }, };