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

[ERROR] Cannot find *.vue module and its type declarations #1897

Closed
angelhdzmultimedia opened this issue Sep 23, 2022 · 7 comments
Closed

[ERROR] Cannot find *.vue module and its type declarations #1897

angelhdzmultimedia opened this issue Sep 23, 2022 · 7 comments
Labels
question Further information is requested

Comments

@angelhdzmultimedia
Copy link

angelhdzmultimedia commented Sep 23, 2022

Volar was working like a charm last time I worked on a Vue 3 TypeScript Vite project.

Today, I created a project with create-vue (which uses Vite too, but provides more options),
and I'm getting this error when a *.ts file has focus:

image

Then, VSCode recommended me the TypeScript Volar extension, and I installed it, and the error went away,
but I'm now confused, didn't Volar already have TS support? Why do I need this other extension now?

Thanks.

@IIFelix
Copy link
Collaborator

IIFelix commented Sep 25, 2022

did you install this one https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin ?

As far as i know if you want to support .ts files you have 2 options:

Activating takeover mode is the recommended way i think so maybe you could switch to that option.
Hope this helps.

@angelhdzmultimedia
Copy link
Author

angelhdzmultimedia commented Sep 25, 2022

Thank you to all the repliers.

Since I installed Volar extension, I haven't had any issues and I've been promoting it for Vue 3 + TypeScript.

Until 3 days ago that I used a create-vue project instead of a Vite one, that this issue started.

So something evidently changed and I can't understand what.

The fact that VSCode told me to install the TS Plugin says something.

So that's why I opened this issue. Not because I don't know who to set up Take Over Mode or those things.
Just I'm curious/confused what changed if I've been using only Volar for TS without issues.

Of course, I did the steps for Take Over Mode, and everything seems to be working now.

@angelhdzmultimedia
Copy link
Author

angelhdzmultimedia commented Oct 12, 2022

Hello again.

Didn't want to saturate the issues section, so I will make my question here, that is directly related to this issue.

New Question

That means that every time that we make a project, pure Vue TS, Nuxt TS, etc., we need to go to Extensions, filter by built-in, find the typescript & javascript extension, disable it for the workspace, reload the workspace?

@johnsoncodehk
Copy link
Member

@angelhdzmultimedia Yes, Vue document has great explain for it: https://vuejs.org/guide/typescript/overview.html#volar-takeover-mode

And you should also track microsoft/vscode#40239

@johnsoncodehk johnsoncodehk added the question Further information is requested label Oct 18, 2022
@unicornware
Copy link

unicornware commented Oct 25, 2022

@johnsoncodehk is there support for vscode insiders?

i installed both volar and the typescript vue plugin, but i'm still getting Cannot find module errors.

i cannot use takeover mode. it crashes vscode whenever i do.

@johnsoncodehk
Copy link
Member

@unicornware can you reproduce this problem in https://github.com/johnsoncodehk/volar-starter? Please provide repro case and open a new issue if it can't reproduce.

And how takeover mode crashes VSCode?

@stouch
Copy link

stouch commented Dec 19, 2023

This helped me :

VSC + Volar setup :

https://vuejs.org/guide/typescript/overview.html#volar-takeover-mode (mentioned in issue : #1173)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants