index.js 749 B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * 环境配置入口
  3. * 手动修改 CURRENT_ENV 切换环境
  4. */
  5. // 手动修改此处切换环境:development | test | production
  6. const CURRENT_ENV = 'development'
  7. // 同步导入所有环境配置
  8. import developmentConfig from './env.development.js'
  9. import productionConfig from './env.production.js'
  10. // 环境配置映射
  11. const envConfigMap = {
  12. development: developmentConfig,
  13. production: productionConfig
  14. }
  15. // 获取当前环境配置
  16. const getCurrentConfig = () => {
  17. return envConfigMap[CURRENT_ENV] || developmentConfig
  18. }
  19. // 导出当前配置
  20. const config = getCurrentConfig()
  21. console.log('当前环境:', config.env, '| API 地址:', config.baseUrl)
  22. export { CURRENT_ENV }
  23. export default config
  24. export { getCurrentConfig }