Skip to content

Circular references between Vue 3 components cannot be resolved #644

@benruehl

Description

@benruehl

We have two components that import each other. This works fine in Vue but leads to lots of errors inside the components' templates displayed in vscode.

We use Vue 3 single-file components with setup tag.
Our components look roughly like this:

MonitorChain.vue

<template>
  <MonitorChainDialog v-if="condition"/>
</template>

<script setup lang="ts">
import MonitorChainDialog from '@/components/MonitorChainDialog.vue'
// ...
</script>

MonitorChainDialog .vue

<template>
  <MonitorChain/>
</template>

<script setup lang="ts">
import MonitorChain from '@/components/MonitorChain.vue'
// ...
</script>

The displayed errors look like this:

image

Every property and imported component of both of the components is marked with "Cannot find name 'X'".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions