primevue
primevue copied to clipboard
Failed to resolve component and Component <Anonymous> is missing template or render function.
Describe the bug
i use nuxt and primevue v4, How to resolve this error: [Vue warn]: Failed to resolve component: ui-button If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
Plugins/primevue.client.ts:
import Button from "primevue/button/"
export default defineNuxtPlugin(nuxtApp => {
nuxtApp.vueApp.use(PrimeVue, {
theme: {
preset: myPreset,
}
})
nuxtApp.vueApp.component('UiButton', Button)
})
Component usage:
Reproducer
https://github.com/andreLuis1506/teste
PrimeVue version
4.0.0-beta-2
Vue version
3.x
Language
TypeScript
Build / Runtime
Nuxt
Browser(s)
No response
Steps to reproduce the behavior
start the server with yarn dev enter in localhost:3000 The erro will the error will appear in the terminal
Expected behavior
No response
I managed to solve the autocomplete by following this recommendation: https://github.com/nuxt/nuxt/issues/25371
Basically I added this code at the end of the plugin:
declare module 'vue' {
interface GlobalComponents {
FontAwesomeIcon: typeof FontAwesomeIcon
}
}
But this warning keeps appearing: [Vue warn]: Failed to resolve component: ui-button If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
Any resolution on this? I'm having a similar issue in my Nuxt project with the Select component.
For context I'm importing all of my components from primevue in nuxt.config.ts