'Failed to resolve component when nesting multiple levels

I'm building a survey app in Vue3 with the following structure:

  • Survey
    • Section
      • Question (Text)
      • Question (Textarea)
      • Question (Number)
      • etc...
      • Question (Repeater)
        • Repeater row
          • Question (Text)
          • Question (Textarea)
          • Question (Number)
          • etc...
          • Question (Repeater)
            • Repeater row
              • etc...

These are all components with each named exactly like I described above.

Section starts looping through the first level of questions:

<div v-for="question in questions" :key="question.id" v-show="question.visible">
  <Question
    ...
  />
</div>

Each question has a parent field (which is just a label) and calls the corresponding name from the database:

<template>
  <Field :label="title">
    <component :is="getComponentByType(type.name)"
    ...
    />
  </Field>
</template>

export default {
  name: 'Question',

  methods: {
    getFieldComponentByType(name) {
      let componentName = ''
      switch (name) {
        case 'number':
          componentName = 'InputNumber'
          break;
        case 'datetime':
          componentName = 'InputDateTime'
          break;
        case 'textarea':
          componentName = 'InputTextarea'
          break;
        case 'repeater':
          componentName = 'Repeater'
          break;

        ... etc

        default:
          componentName = 'InputText'
          break;
      }
      return componentName
    }
  }
}

Then there can also be an repeater question which just loops through the child questions

<div v-for="question in questions" :key="question.id" v-show="question.visible">
  <Question
    ...
  />
</div>

For the repeater Question I receive the following error from vue:

[Vue warn]: Failed to resolve component: Question
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement. 
  at <Repeater required=false formId=125 name=393  ... > 

The strange thing is when I build this structure in vue2 it works but in vue3 not. Why is vue3 having conflicts when I recall components in a nested structure? I don't want to have to duplicate my code in for example RepeaterQuestion.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source