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

Version v2.0.28 can't resolve .vue files #4632

Closed
scandar opened this issue Jul 31, 2024 · 12 comments
Closed

Version v2.0.28 can't resolve .vue files #4632

scandar opened this issue Jul 31, 2024 · 12 comments
Labels
bug Something isn't working ❗ p4-important

Comments

@scandar
Copy link

scandar commented Jul 31, 2024

Vue - Official extension or vue-tsc version

v2.0.26

VSCode version

Version: 1.91.1 (Universal)

Vue version

3.3.13

TypeScript version

5.4.5

System Info

System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Pro
    Memory: 186.03 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.15.1 - ~/.nvm/versions/node/v20.15.1/bin/node
    npm: 10.7.0 - ~/.nvm/versions/node/v20.15.1/bin/npm
    pnpm: 9.4.0 - ~/.nvm/versions/node/v20.15.1/bin/pnpm
  Browsers:
    Safari: 17.5

Steps to reproduce

in a pnpm monorepo with this structure
apps
|_foo
packages
|_ui

packages/ui includes vue components, when a component is imported from packages/ui in apps/foo vscode shows this error.

Cannot find module "path to component" or its corresponding type declarations

reverting to a previous version doesn't show the error

What is expected?

The component should be resolved properly

What is actually happening?

Cannot find module "path to component" or its corresponding type declarations

Link to minimal reproduction

No response

Any additional comments?

No response

@arpadgabor
Copy link

Seeing the same issue here. Reverted to 2.0.26 and all is fine now. We have a similar project structure with components in another package in a monorepo. We also have the vscode file watcher disabled.

@davidmatter
Copy link
Collaborator

Can't reproduce. Please provide a minimal example repo

@arpadgabor
Copy link

Here you go (check in app/src/App.vue):

https://github.com/arpadgabor/vue-volar-bug-repro

And here are a couple of screenshot with the behaviour in VSCode in v2.0.28 vs v2.0.26:

2.0.28
2.0.26

@davidmatter davidmatter added pending triage bug Something isn't working and removed need info pending triage labels Aug 5, 2024
@davidmatter
Copy link
Collaborator

Workaround for now:

app/tsconfig.json:
image

@bosens-China
Copy link

follow with interest

@bosens-China
Copy link

Workaround for now:

app/tsconfig.json: image

This solution is ineffective

image

@KazariEX
Copy link
Collaborator

KazariEX commented Aug 8, 2024

Please try updating all dependencies to the latest version.

@davidmatter
Copy link
Collaborator

davidmatter commented Aug 8, 2024

Confirmed, pnpm update -r solves this

Update: Only until you reload the window. We need to look into this

@scandar
Copy link
Author

scandar commented Aug 8, 2024

@davidmatter it would be better to identify the exact dependency that I should update.

@dbarjs
Copy link

dbarjs commented Aug 8, 2024

This issue is affecting external component libraries.

Here is an example of the use of the nuxt-mapbox Nuxt module installed with version v2.0.28:
Screenshot from 2024-08-08 13-17-36

It only happens with .vue components using the script setup.

Example 1: This component from the @nuxt/content module works correctly (the .d.ts file is available in the dist):
https://github.com/nuxt/content/blob/main/docs/components/content/Example/ExampleTitle.vue

Example 2: This component from nuxt-mapbox doesn't work (it does not have a .d.ts file in the dist):
https://github.com/AlexLavoie42/Nuxt-Mapbox/blob/main/src/runtime/components/Map.vue

Both examples above work correctly with version v2.0.26 installed on VSCode.

@Gehbt
Copy link
Contributor

Gehbt commented Aug 9, 2024

Script block is don't matter. If restart the server, it will degrade to any, too.
Only at new files or renamed files could be correctly get the type.

@codethief
Copy link

codethief commented Aug 22, 2024

For anyone else coming here who like me thought the ticket might be about project references (i.e. similar to #4711): OP's example code does involve project references but it uses separate pnpm workspaces for their folders /app and /ui (each with its own solution-style tsconfig.json) and then they include the /ui workspace in their /app/package.json:

  "dependencies": {
    "ui":"workspace:*",

so as to make it available in their app's node_modules. So the issue seems to be not so much about project references (#4711) but more similar in nature to #4611 and #4607 (though of course maybe those issues are all the same under the hood – I have no idea).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ❗ p4-important
Projects
None yet
Development

No branches or pull requests

8 participants