| 12345678910111213141516171819202122232425262728293031 |
- /**
- * 环境配置入口
- * 手动修改 CURRENT_ENV 切换环境
- */
- // 手动修改此处切换环境:development | test | production
- const CURRENT_ENV = 'development'
- // 同步导入所有环境配置
- import developmentConfig from './env.development.js'
- import productionConfig from './env.production.js'
- // 环境配置映射
- const envConfigMap = {
- development: developmentConfig,
- production: productionConfig
- }
- // 获取当前环境配置
- const getCurrentConfig = () => {
- return envConfigMap[CURRENT_ENV] || developmentConfig
- }
- // 导出当前配置
- const config = getCurrentConfig()
- console.log('当前环境:', config.env, '| API 地址:', config.baseUrl)
- export { CURRENT_ENV }
- export default config
- export { getCurrentConfig }
|