naming conflicts with other components【vue3】

发布时间 2024-01-09 19:53:07作者: zyp_java_net

问题描述:

vue3中有相同名称的文件时,会报错

[unplugin-vue-components] component "Xxx"(D:/a/b/xxx.vue) has naming conflicts with other components, ignored.

 

解决方案:

修改vite.config.ts 加上 directoryAsNamespace: true

 

export default defineConfig(({ command }) => {
return {
plugins: [
vue(),
// 组件按需引入
ViteComponents({
directoryAsNamespace: true,