NervJS/taro

new-blended模式,报错“Please do not register multiple Pages”

Opened this issue · 5 comments

相关平台

微信小程序

小程序基础库: 3.4.5
使用框架: React

复现步骤

官方new-blended demo,在小程序app.json文件中添加"lazyCodeLoading": "requiredComponents",重新编译打开taro页面,会报错“Please do not register multiple Pages”

期望结果

页面、组件正常打开

实际结果

报错

环境信息

  Taro CLI 3.6.18 environment info:
    System:
      OS: macOS 14.4.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 16.18.0 - ~/.nvm/versions/node/v16.18.0/bin/node
      Yarn: 1.22.10 - /usr/local/bin/yarn
      npm: 8.19.2 - ~/.nvm/versions/node/v16.18.0/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.12 => 3.6.12 
      @tarojs/components: 3.6.12 => 3.6.12 
      @tarojs/helper: 3.6.12 => 3.6.12 
      @tarojs/plugin-framework-react: 3.6.12 => 3.6.12 
      @tarojs/plugin-platform-weapp: 3.6.12 => 3.6.12 
      @tarojs/react: 3.6.12 => 3.6.12 
      @tarojs/runtime: 3.6.12 => 3.6.12 
      @tarojs/shared: 3.6.12 => 3.6.12 
      @tarojs/taro: 3.6.12 => 3.6.12 
      @tarojs/webpack5-runner: 3.6.12 => 3.6.12 
      babel-preset-taro: 3.6.12 => 3.6.12 
      eslint-config-taro: 3.6.12 => 3.6.12 
      react: ^16.10.0 => 16.14.0 

哈哈兄弟,我遇到跟你一样的问题,刚想提 issue,就看见你提了

找到一个解决办法了,页面与组件的顺序是倒着写的
官网例子:components: ['pages/index/index', 'components/picker/index'],
解决办法:components: ['components/picker/index', 'pages/index/index'],

这样感觉没什么意义😂实际中肯定会有很多组件,且不一定将page列为components导出。

我现在的解决办法是将taro components放到原生微信的全局组件中,但这也不是长久之计。期待官方修复~

这样感觉没什么意义😂实际中肯定会有很多组件,且不一定将page列为components导出。

我现在的解决办法是将taro components放到原生微信的全局组件中,但这也不是长久之计。期待官方修复~

老哥,请问如何将 taro components 放到原生的全局组件呀

这样感觉没什么意义😂实际中肯定会有很多组件,且不一定将page列为components导出。
我现在的解决办法是将taro components放到原生微信的全局组件中,但这也不是长久之计。期待官方修复~

老哥,请问如何将 taro components 放到原生的全局组件呀

taro components放到原生小程序的app.json中的usingComponents,例如这样:

"usingComponents":{
    "blended-test": "taro/components/blendedTest/index"
}