feat: 初始化提交
笑笑 authored at 2025-05-13 21:25:06
757.00 B
cube-front
import type { CubeFrontConfig } from '../types'
import { developmentConfig } from './development'
import { productionConfig } from './production'
import { defaultConfig } from '../defaultConfig'
import { deepMerge } from '../../utils/object'

/**
 * 获取环境特定配置
 * @param env 环境类型
 * @returns 合并后的配置
 */
export function getEnvConfig(env: string = import.meta.env.MODE): CubeFrontConfig {
  let envConfig = {}

  switch (env) {
    case 'development':
      envConfig = developmentConfig
      break
    case 'production':
      envConfig = productionConfig
      break
    case 'test':
      envConfig = {}
      break
    default:
      envConfig = {}
  }

  return deepMerge(defaultConfig, envConfig) as CubeFrontConfig
}