quanyawei
2024-06-27 e07b984728e0a97473b2954d097afac4a5c8b80a
.env.js
New file
@@ -0,0 +1,18 @@
let ENV_CONFIG = {};
if (process.env.NODE_ENV === "development") {
  //开发环境
  ENV_CONFIG = require(".env.dev.js");
  console.log("开发环境!");
} else {
  //生产环境
  ENV_CONFIG = require(".env.prod.js");
  console.log("生产环境!");
}
//给环境变量process.uniEnv赋值
if (ENV_CONFIG) {
  process.uniEnv = {};
  for (let key in ENV_CONFIG) {
    process.uniEnv[key] = ENV_CONFIG[key];
  }
}