primevue icon indicating copy to clipboard operation
primevue copied to clipboard

Failed to resolve component and Component <Anonymous> is missing template or render function.

Open andreLuis1506 opened this issue 9 months ago • 2 comments

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: The component appears normally on the screen, and all props work, but this error appears in the terminal and the IDE does not offer any auto complite for the component Some help?

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

andreLuis1506 avatar May 09 '24 21:05 andreLuis1506

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.

andreLuis1506 avatar May 10 '24 17:05 andreLuis1506

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

tommy3wood avatar Oct 17 '24 00:10 tommy3wood