Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
andreLuis1506 opened this issue May 9, 2024 · 1 comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@andreLuis1506
Copy link

andreLuis1506 commented May 9, 2024

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 andreLuis1506 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label May 9, 2024
@andreLuis1506
Copy link
Author

andreLuis1506 commented May 10, 2024

I managed to solve the autocomplete by following this recommendation: nuxt/nuxt#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

1 participant