Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

ilyaliao
Copy link
Collaborator

Description

This PR is a minimal implementation of #612. Since the original PR is outdated, I’m submitting a new one.

It simply adds support for prefixing component names.

Linked Issues

resolve: #438

Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@ilyaliao ilyaliao marked this pull request as ready for review June 25, 2025 14:48
@ilyaliao ilyaliao requested a review from antfu as a code owner June 25, 2025 14:48
@ilyaliao ilyaliao marked this pull request as draft June 25, 2025 14:48
@ilyaliao ilyaliao marked this pull request as ready for review June 25, 2025 15:25
@antfu antfu merged commit 6d86696 into unplugin:main Jun 29, 2025
6 checks passed
@ilyaliao ilyaliao deleted the feat/prefix branch July 1, 2025 04:45
@jongbonga
Copy link

@ilyaliao how do I make this work with primevue? I tried but the component doesn't show, see reproduction and issue

@ilyaliao
Copy link
Collaborator Author

ilyaliao commented Jul 17, 2025

@ilyaliao how do I make this work with primevue? I tried but the component doesn't show, see reproduction and issue

Hi jongbonga 👋

Thanks for asking, but sorry, this PR doesn't include adding prefix in resolvers, but I think I can help you solve the problem!

Please refer to: primefaces/primevue#6875 (comment)

@craigrileyuk
Copy link

craigrileyuk commented Jul 28, 2025

This should probably be added to the README documentation now it's merged.

@ilyaliao
Copy link
Collaborator Author

This should probably be added to the README documentation now it's merged.

Good idea! Would you like to open a PR?

@jhoefker
Copy link

jhoefker commented Jul 31, 2025

Hey guys, thanks for adding support for prefix. Unfortunately, I face an issue while importing the components.

My setup:
vite.config.js

Components({prefix: 'Pre'})

... the components.d.ts is generated correctly with:

...
PreBadgeCircle: typeof import('./src/components/design-system/badge-circle/badge-circle.vue')['default']
...

However I can't import the component with <pre-badge-circle> in my components. I get this error:

Failed to resolve component: pre-badge-circle
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.

Interesting is that using <badge-circle> still works.

Have I forgot something in the config?

@ilyaliao
Copy link
Collaborator Author

Hey guys, thanks for adding support for prefix. Unfortunately, I face an issue while importing the components.

My setup: vite.config.js

Components({prefix: 'Pre'})

... the components.d.ts is generated correctly with:

...
PreBadgeCircle: typeof import('./src/components/design-system/badge-circle/badge-circle.vue')['default']
...

However I can't import the component with <pre-badge-circle> in my components. I get this error:

Failed to resolve component: pre-badge-circle
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.

Interesting is that using <badge-circle> still works.

Have I forgot something in the config?

This looks like a bug, I will fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How do we add prefix for all components?
5 participants