unplugin/unplugin-vue-components

Directory prefix doesn't appear to work

timothymarois opened this issue · 1 comments

Describe the bug

When using this config:

Components({
   directoryAsNamespace: true,
   collapseSamePrefixes: true,
   dirs: [
       './resources/js/Layouts/**',
       './resources/js/Components/**',
   ],
   imports: [
   {
       '@inertiajs/vue3': ['Head', 'Link'],
   },
   ],
   dts: true,
   deep: true,
   resolvers: [
       PrimeVueResolver()
   ]
}),

Components testing with:

/Components/Example/Container.vue and /Components/Other/Container.vue.

These options appear to have no effect. I have checked the components.d.ts file, and it still only includes one of the components with the same name; the other component gets ignored.

directoryAsNamespace: true,
collapseSamePrefixes: true,

error

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

How it imports just the single item, adds no prefix or additional component

WHAT IT DOES:

Container: typeof import('./resources/js/Components/Example/Container.vue')['default']

WHAT IT SHOULD DO:

ExampleContainer: typeof import('./resources/js/Components/Example/Container.vue')['default'],
OtherContainer: typeof import('./resources/js/Components/Other/Container.vue')['default']

Everything else works except this config.

Reproduction

/

System Info

Vue 3, basic setup.

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Found the issue:

Changing this dir, instead of wild as described above, removing the wild and now it works.

dirs: [
    './resources/js/Components/'
],

Strange it does it this way, but solved it after a lot of testing. Can close for now.