在 taro 的 config 文件中 设置 BASE_URL 代码 如下
module.exports = {
env: {
NODE_ENV: '"development"'
},
BASE_URL: '"https://test-mpcs.fleetingpower.com"',
defineConstants: {},
weapp: {},
h5: {}
};
但是打印的时候 console.log(process.BASE_URL) 永远是 undefined
不知道怎么使用
/**
* 这段注释后可以贴代码
* 提供完整可复现的代码和整理好代码格式,有助于我们快速定位问题,节省你我时间
* 代码提供不全或代码格式混乱的 issues 【有可能会被忽略】
*
* 查看如何插入代码:https://coding.net/help/doc/project/markdown.html#i-5
*/
Taro CLI 2.0.6 environment info:
System:
OS: macOS High Sierra 10.13.6
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.16.2 - /usr/local/bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.11.2 - /usr/local/bin/npm
npmPackages:
@tarojs/async-await: 2.0.6 => 2.0.6
@tarojs/components: 2.0.6 => 2.0.6
@tarojs/mini-runner: 2.0.6 => 2.0.6
@tarojs/plugin-babel: 2.0.6 => 2.0.6
@tarojs/plugin-csso: 2.0.6 => 2.0.6
@tarojs/plugin-less: 2.0.6 => 2.0.6
@tarojs/plugin-sass: 2.0.6 => 2.0.6
@tarojs/plugin-uglifyjs: 2.0.6 => 2.0.6
@tarojs/redux: 2.0.6 => 2.0.6
@tarojs/redux-h5: 2.0.6 => 2.0.6
@tarojs/router: 2.0.6 => 2.0.6
@tarojs/taro: 2.0.6 => 2.0.6
@tarojs/taro-alipay: 2.0.6 => 2.0.6
@tarojs/taro-h5: 2.0.6 => 2.0.6
@tarojs/taro-swan: 2.0.6 => 2.0.6
@tarojs/taro-tt: 2.0.6 => 2.0.6
@tarojs/taro-weapp: 2.0.6 => 2.0.6
@tarojs/webpack-runner: 2.0.6 => 2.0.6
eslint-config-taro: 2.0.6 => 2.0.6
eslint-plugin-taro: 2.0.6 => 2.0.6
nerv-devtools: ^1.5.6 => 1.5.6
nervjs: ^1.5.6 => 1.5.6
stylelint-config-taro-rn: 2.0.6 => 2.0.6
stylelint-taro-rn: 2.0.6 => 2.0.6
如果您有功能上的建议,可以提到 FeatHub
使用上的问题,欢迎在「Taro 社区」一起交流
看 docs 仔细一些, 正确写法:
module.exports = {
...,
defineConstants: {
BASE_URL: '"https://test-mpcs.fleetingpower.com"',
},
};
感谢
Most helpful comment
看 docs 仔细一些, 正确写法: