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'), + }, } })