shangfutong-ui/jeepay-ui-uapp-cashier/env/config.js

28 lines
792 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* ENV 的封装
* 由于uniapp 无法设置.env等打包属性实现线上线下多版本配置属性的无缝切换。
* process.env.NODE_ENV 将在打包环境通过编译器进行替换, 线上打包后无法获取到 process对象。 所以将配置属性统一封装到appConfig中。
*
* @author terrfly
* @site https://www.jeequan.com
* @date 2021/12/16 17:57
*/
import appConfig from '@/config/appConfig.js';
import development from '@/env/env.development.js';
import production from '@/env/env.production.js';
// 引入变量
const envConfig = {development: development, production : production}
// 获取当前环境变量
const currentEnv = envConfig[process.env.NODE_ENV]
// 设置全局env配置项目
appConfig.env = currentEnv
export default this