taro yarn dev:rn 报错

bxpogfeg  于 2023-02-04  发布在  Yarn
关注(0)|答案(4)|浏览(315)

相关平台

React Native

使用框架: React

复现步骤

初次执行 yarn dev:rn 就报错,无法正常编译到react-native

期望结果

期望编译成功,运行不报错

实际结果

编译报错

环境信息

👽 Taro v3.5.6

  Taro CLI 3.5.6 environment info:
    System:
      OS: macOS 13.0
      Shell: 5.8.1 - /bin/zsh
    Binaries:
      Node: 16.6.0 - ~/.nvm/versions/node/v16.6.0/bin/node
      Yarn: 1.22.19 - ~/.nvm/versions/node/v16.6.0/bin/yarn
      npm: 7.19.1 - ~/.nvm/versions/node/v16.6.0/bin/npm
    npmPackages:
      @tarojs/cli: ^3.5.6 => 3.5.6 
      @tarojs/components: ^3.5.6 => 3.5.6 
      @tarojs/helper: ^3.5.6 => 3.5.6 
      @tarojs/mini-runner: 3.5.6 => 3.5.6 
      @tarojs/plugin-framework-react: ^3.5.6 => 3.5.6 
      @tarojs/plugin-platform-swan: ^3.5.6 => 3.5.6 
      @tarojs/react: ^3.5.6 => 3.5.6 
      @tarojs/rn-runner: ^3.5.10 => 3.5.10 
      @tarojs/router: ^3.5.6 => 3.5.6 
      @tarojs/runtime: ^3.5.6 => 3.5.6 
      @tarojs/shared: ^3.5.6 => 3.5.6 
      @tarojs/taro: ^3.5.6 => 3.5.6 
      @tarojs/taro-h5: ^3.5.6 => 3.5.6 
      @tarojs/taro-rn: ^3.5.10 => 3.5.10 
      @tarojs/webpack5-runner: ^3.5.6 => 3.5.6 
      babel-preset-taro: 3.5.6 => 3.5.6 
      eslint-config-taro: 3.5.6 => 3.5.6 
      expo: ~46.0.1 => 46.0.19 
      react: ^18.0.0 => 18.2.0 
      react-native: ^0.69.3 => 0.69.7 
      taro-ui: 3.0.0-alpha.10 => 3.0.0-alpha.10
zazmityj

zazmityj2#

提供下demo

@zhiqingchen
Demo地址: https://github.com/xianguoGou/taro-rn-test-demo
运行命令 yarn dev:rn 即可复现

通过测试, 发现 /config/dev.js 文件中的 defineConstants 属性定义多个常量会抛错。截图如下:

defineConstants: {
    domain1: '"https://www.baidu.com/"',
    /**
* 注释掉以下常量,就不会抛错,取消注释则报错
*/
    domain2: '"https://github.com/"',
    domain3: '"https://www.npmjs.com/"',
    config: JSON.stringify({
      a: 'hello world',
      b: 123
    })
 }
wnrlj8wa

wnrlj8wa3#

试试不使用

config: JSON.stringify({
      a: 'hello world',
      b: 123
    })
zu0ti5jz

zu0ti5jz4#

试试不使用

config: JSON.stringify({
      a: 'hello world',
      b: 123
    })

不行,常量配置超过1个,都会报错

相关问题