question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unknown custom element warning with recursive components, babel

See original GitHub issue

Version

2.5.2

Reproduction link

https://github.com/adam-cowley/nestedtest

Steps to reproduce

The repo is based on the webpack template. Run npm run dev to start the project.

What is expected?

I am attempting to reuse components in a nested pattern. The EntityComponent should render a RelationshipComponent which should in turn render an EntityComponent.

What is actually happening?

Although each component is defined with a name property, I receive the following warning in the console and nothing rendered on the page.

Unknown custom element: <EntityComponent> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

If I make a change to the EntityComponent file, it will hot swap in the component which will render without a warning.

I’ve tried in vain to set keys and a name property on the child element and rename the element. Attempting to alias the component name has also proved unsuccessful.

Removing the component means the rest of the component appears correctly.


This is a barebones reproduction but the final version uses vuex for state management. Each child component has a reference property passed through it, then a getter is used to pull the information for that specific reference from an array in the store. Using ‘v-for’ on a div will list the relevant array entries so this part works. It seems that the name property is being ignored for the nested component.

I’m struggling to find any documentation on this - possibly due to using the wrong keywords? I’m happy to write a blog post if/when this gets resolved to give others a helping hand.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
posvacommented, Mar 15, 2018
3reactions
adam-cowleycommented, Mar 15, 2018

Yep, I’ve defined that in the export for both files

export default {
    name: 'EntityComponent',
    components: {
        RelationshipComponent,
    },
    props: {
        name: String,
        children: Array,
    },
}

https://github.com/adam-cowley/nestedtest/blob/master/src/components/EntityComponent.vue#L16

Using name as a prop could be a little confusing, apologies for that. I also tried it as a prop in the original project out of sheer desperation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue warning: Unknown custom element - laravel
For recursive components, make sure to provide the "name" option. my add-video.blade.php <div class="panel panel-default ...
Read more >
How to Solve "Unknown Custom Element" in Vue
For recursive components, make sure to provide the "name" option. Don't worry, I'll show you exactly how to fix this. You need to...
Read more >
mdb-input> - did you register the component correct
[Vue warn]: Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option.
Read more >
Error : Unknown custom element: <nuxt-link> - did you register ...
In my application I am facing one issue. [Vue warn]: Unknown custom element: - did you register the component correctly? For recursive ......
Read more >
5 mins to fix jest tests for app with: Unknown custom element
Check your node_modules package and install missing packages / components modules. Or reinstall your node_modules via `npm install`. Reference: https:// ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found