diff --git a/.env.development b/.env.development index ee6c1c96..7bebb92e 100644 --- a/.env.development +++ b/.env.development @@ -1,6 +1,7 @@ # 开发环境变量 # 变量必须以 VITE_ 为前缀才能暴露给外部读取 +NODE_ENV='development' VITE_APP_TITLE = '管理系统' VITE_APP_PORT = 3000 diff --git a/.env.production b/.env.production index 89e04cae..56a5a099 100644 --- a/.env.production +++ b/.env.production @@ -1,4 +1,6 @@ # 生产环境变量 +NODE_ENV='production' + VITE_APP_TITLE = '管理系统' VITE_APP_PORT = 3000 VITE_APP_BASE_API = '/prod-api' diff --git a/.env.staging b/.env.staging index da543f6a..31bbdc9a 100644 --- a/.env.staging +++ b/.env.staging @@ -1,4 +1,6 @@ # 模拟环境变量 +NODE_ENV='staging' + VITE_APP_TITLE = '管理系统' VITE_APP_PORT = 3000 VITE_APP_BASE_API = '/stage-api' diff --git a/src/env.d.ts b/src/env.d.ts index e8b0bee7..faadf803 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -10,6 +10,7 @@ declare module '*.vue' { // 环境变量智能提示 interface ImportMetaEnv { + NODE_ENV:string, VITE_APP_TITLE: string, VITE_APP_PORT: string, VITE_APP_BASE_API: string