Skip to content

Directory prefix doesn't appear to work #774

@timothymarois

Description

@timothymarois

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.

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