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

Module @vue/runtime-core cannot be reconized by language server #4401

Closed
RayGuo-ergou opened this issue May 18, 2024 · 2 comments
Closed

Module @vue/runtime-core cannot be reconized by language server #4401

RayGuo-ergou opened this issue May 18, 2024 · 2 comments
Labels
good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first question Further information is requested

Comments

@RayGuo-ergou
Copy link
Contributor

RayGuo-ergou commented May 18, 2024

I found this issue when working with a project uses element-plus, they use @vue/runtime-core to declare global components. I did some research and seems vue document also uses vue now ( I remembered before prefer @vue/runtime-core?)

e.g. for code

import BaseInput from '@/components/BaseInput.vue'
import BaseButton from '@/components/BaseButton.vue'
declare module 'vue' {
  export interface GlobalComponents {
    BaseInput: typeof BaseInput,
  }
}

declare module '@vue/runtime-core' {
  export interface GlobalComponents {
    BaseButton: typeof BaseButton,
  }
}

image

minimal reproduction: https://github.com/RayGuo-ergou/volar_reproduction_global_component_ts

Language server version: 2.0.19
@johnsoncodehk
Copy link
Member

This depends on whether the module is located in the top directory of node_modules.

When using npm, both definitions are valid. But when using pnpm, the top directory of node_modules only contains vue and not @vue/runtime-core, so declare module '@vue/runtime-core' is invalid.

This is a solution to a different but related issue: #4170 (comment)

@johnsoncodehk johnsoncodehk added question Further information is requested good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first labels May 23, 2024
@RayGuo-ergou
Copy link
Contributor Author

that makes sense, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants