本文主要是介绍报错:has naming conflicts with other components, ignored,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在 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})
]
这篇关于报错:has naming conflicts with other components, ignored的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!