NervJS / taro

开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/
https://docs.taro.zone/
Other
35.61k stars 4.8k forks source link

使用自定义组件,控制台很多Failed to resolve component的警告 #16607

Open ffhope opened 1 month ago

ffhope commented 1 month ago

相关平台

微信小程序

小程序基础库: 3.5.8 使用框架: Vue 3

复现步骤

在index.config.ts里配置export default { navigationStyle: 'custom', enableShareAppMessage: true, navigationBarTitleText: ' ', transparentTitle: 'always', titlePenetrate: 'YES', navigationBarTextStyle: 'white', backgroundColor: '#ffffff', enablePullDownRefresh: false, disableScroll: true, usingComponents: { 'debug-tool': '../../scopeComponent/DebugTool', }, componentPlaceholder: { 'debug-tool': 'View', }, };

会导致微信小程序有警告[Vue warn]: Failed to resolve component: debug-tool If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.

按照官网教程配置
[ '@tarojs/plugin-framework-vue3', { vueLoaderOption: { compilerOptions: { isCustomElement: (tag) => tag.includes('debug'), whitespace: 'preserve', }, reactivityTransform: true, // 开启vue3响应性语法糖 }, }, ], 依然有警告

期望结果

控制台没有[Vue warn]: Failed to resolve component的警告

实际结果

所有用usingComponents配置的这种的组件全部都报了警告

环境信息

Taro CLI 4.0.5 environment info:
    System:
      OS: macOS 14.2
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 16.20.2 - /usr/local/bin/node
      Yarn: 1.22.22 - /usr/local/bin/yarn
      npm: 8.19.4 - /usr/local/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.32 => 3.6.35 
      @tarojs/components: 3.6.32 => 3.6.35 
      @tarojs/helper: 3.6.32 => 3.6.35 
      @tarojs/plugin-framework-vue3: 3.6.32 => 3.6.35 
      @tarojs/plugin-html: 3.6.32 => 3.6.35 
      @tarojs/runtime: 3.6.32 => 3.6.35 
      @tarojs/shared: 3.6.32 => 3.6.35 
      @tarojs/taro: 3.6.32 => 3.6.35 
      @tarojs/webpack5-runner: 3.6.32 => 3.6.35 
      babel-preset-taro: 3.6.32 => 3.6.35 
      eslint-config-taro: 3.6.21 => 3.6.21 
bandajia123 commented 1 day ago

老哥解决了吗,我也遇到这个问题,需要引入第三方的原生组件。