首页 前端知识 报错:has naming conflicts with other components, ignored

报错:has naming conflicts with other components, ignored

2024-08-24 23:08:09 前端知识 前端哥 211 141 我要收藏

Vue 项目编译时,出现如下报错

[unplugin-vue-components] component "xxx"(xxx/Index.vue) has naming conflicts with other components, ignored.
[unplugin-vue-components] component "xxx"(xxx/Index.vue) has naming conflicts with other components, ignored.
[unplugin-vue-components] component "xxx"(xxx/Index.vue) has naming conflicts with other components, ignored.
[unplugin-vue-components] component "xxx"(xxx/Index.vue) has naming conflicts with other components, ignored.

因为本人的个人习惯,在写组件时,通常都是以 Index.vue 进行命名,造成项目拥有大量的同名文件而出现上述报错。

解决方案

unplugin-vue-components 插件配置 directoryAsNamespace 属性为 true 即可。

// vite.config.ts
plugins: [
    vue(),
    Components({
        // ... 其它配置
        // 允许子目录作为组件的命名空间前缀
        directoryAsNamespace: true
    })
]
转载请注明出处或者链接地址:https://www.qianduange.cn//article/16811.html
标签
评论
发布的文章

jQuery File Upload 使用教程

2024-09-03 02:09:33

jQuery笔记

2024-05-03 18:05:51

jQuery-Spectragram 使用教程

2024-09-03 02:09:26

echarts问题汇总

2024-09-03 02:09:12

echarts自定义悬浮提示

2024-09-03 02:09:12

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!