Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config defineConstants 参数,在微信小程序获取的参数带双引号 #5078

Closed
dodofun opened this issue Dec 13, 2019 · 2 comments
Closed
Assignees

Comments

@dodofun
Copy link

dodofun commented Dec 13, 2019

问题描述

配置文件 config 下, defineConstants 参数,在微信小程序获取的参数带双引号

复现步骤

  1. 运行 npm run dev:weapp,打印 config 定义的参数 _PLATFORM_API_HOST,获取到的结果 :"https://test.com",携带双引号
  2. 运行 npm run dev:h5,打印 config 定义的参数 _PLATFORM_API_HOST,获取到的结果 :https://test.com,不携带双引号
  3. taro 版本 2.0.0-beta.8,之前的 1.3.x 版本无此问题

代码如下

module.exports = {
  env: {
    NODE_ENV: '"development"'
  },
  defineConstants: {
    _PLATFORM_API_HOST: '"https://test.com"'
  },
  mini: {},
  h5: {
    publicPath: '/',
    devServer: {
      port: 7200,
      https: false
    }
  }
}

期望行为

在不同端程序中获取到的参数值为 :https://test.com,不携带双引号。

报错信息

系统信息

npmPackages:

  @tarojs/async-await: 2.0.0-beta.8 => 2.0.0-beta.8 
  @tarojs/cli: 2.0.0-beta.8 => 2.0.0-beta.8 
  @tarojs/components: 2.0.0-beta.8 => 2.0.0-beta.8 
  @tarojs/components-qa: 2.0.0-beta.8 => 2.0.0-beta.8 
  @tarojs/mobx: 2.0.0-beta.8 => 2.0.0-beta.8 
  @tarojs/mobx-h5: 2.0.0-beta.8 => 2.0.0-beta.8 
  @tarojs/mobx-rn: 2.0.0-beta.8 => 2.0.0-beta.8 
  @tarojs/rn-runner: 2.0.0-beta.8 => 2.0.0-beta.8 
  @tarojs/router: 2.0.0-beta.8 => 2.0.0-beta.8 
  @tarojs/taro: 2.0.0-beta.8 => 2.0.0-beta.8 
  @tarojs/taro-alipay: 2.0.0-beta.8 => 2.0.0-beta.8 
  @tarojs/taro-h5: 2.0.0-beta.8 => 2.0.0-beta.8 
  @tarojs/taro-qq: 2.0.0-beta.8 => 2.0.0-beta.8 
  @tarojs/taro-quickapp: 2.0.0-beta.8 => 2.0.0-beta.8 
  @tarojs/taro-swan: 2.0.0-beta.8 => 2.0.0-beta.8 
  @tarojs/taro-tt: 2.0.0-beta.8 => 2.0.0-beta.8 
  @tarojs/taro-weapp: 2.0.0-beta.8 => 2.0.0-beta.8 
  @tarojs/webpack-runner: 2.0.0-beta.8 => 2.0.0-beta.8 
  eslint-config-taro: 2.0.0-beta.8 => 2.0.0-beta.8 
  eslint-plugin-taro: 2.0.0-beta.8 => 2.0.0-beta.8 
  nerv-devtools: ^1.5.5 => 1.5.6 
  nervjs: ^1.5.5 => 1.5.6 
  stylelint-config-taro-rn: 2.0.0-beta.8 => 2.0.0-beta.8 
  stylelint-taro-rn: 2.0.0-beta.8 => 2.0.0-beta.8 

补充信息

如果您有功能上的建议,可以提到 FeatHub

使用上的问题,欢迎在「Taro 社区」一起交流

@taro-bot
Copy link

taro-bot bot commented Dec 13, 2019

CC @Chen-jj

@taro-bot
Copy link

taro-bot bot commented Dec 13, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants