Skip to content

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

Open
@ffhope

Description

@ffhope

相关平台

微信小程序

小程序基础库: 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 

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions