【发布时间】:2020-09-18 12:24:09
【问题描述】:
我的 vue.js + webpack + npm 项目中有一个配置文件
/plugins/http/GLOBAL_CONST.js
const GLOBAL_CONST = {}
GLOBAL_CONST.BASE_URL = "http://www.example.com/" // "http://localhost:3000/"
GLOBAL_CONST.BASE_API = "http://www.example:8000/" // "http://localhost:8000/"
export default GLOBAL_CONST
我有一个要求,如果我运行npm run dev,则
GLOBAL_CONST.BASE_URL = "http://localhost:3000/"
GLOBAL_CONST.BASE_API = "http://localhost:8000/"
如果我运行 npm run build 它使用:
GLOBAL_CONST.BASE_URL = "http://www.example.com/"
GLOBAL_CONST.BASE_API = "http://www.example:8000/"
有可能实现吗?
【问题讨论】: