From bef13b41e6da9943ca8bf1cebf05215377d8a2bf Mon Sep 17 00:00:00 2001 From: zhanghao <774378400@qq.com> Date: Fri, 11 Sep 2026 10:27:38 +0800 Subject: [PATCH] =?UTF-8?q?feat(env):=20=E6=B7=BB=E5=8A=A0=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=90=8D=E7=A7=B0=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E5=B9=B6=E6=9B=B4=E6=96=B0=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 1 + .env.production | 1 + .npmrc | 1 + vite.config.js | 6 +++++- 4 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .npmrc diff --git a/.env.development b/.env.development index 705c892..9ab4824 100644 --- a/.env.development +++ b/.env.development @@ -12,3 +12,4 @@ VITE_WS_URL = ws://192.168.0.199:14080/ws VITE_PORT = 5174 VITE_INSPECTION_TYPE = "inspection" VITE_MINIO_URL = "http://192.168.28.10:9000/cmvr-iot/" +__PROJECT_NAME__ = "cmvr" \ No newline at end of file diff --git a/.env.production b/.env.production index 6b82b87..38d82e3 100644 --- a/.env.production +++ b/.env.production @@ -15,3 +15,4 @@ VITE_API_URL = http://192.168.28.10:13080 VITE_WS_URL = ws://192.168.0.201:13080/ws VITE_INSPECTION_TYPE = "inspection" VITE_MINIO_URL = "http://192.168.28.10:9000/cmvr-iot/" +__PROJECT_NAME__ = "cmvr" diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..57429e5 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +@cmvr:registry=http://192.168.28.10:4873/ \ No newline at end of file diff --git a/vite.config.js b/vite.config.js index 6377465..fd222e9 100644 --- a/vite.config.js +++ b/vite.config.js @@ -107,6 +107,10 @@ export default defineConfig(({ mode, command }) => { additionalData: `@use "${variablePath}" as *;` } } - } + }, + define: { + // 将环境变量注入到全局常量中 + '__PROJECT_NAME__': JSON.stringify(env.PROJECT_NAME || 'changan'), + }, } })