-
-
Notifications
You must be signed in to change notification settings - Fork 594
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Dependencies should be project-specific (wrong dependency with useWorkspaceDependencies) #3137
Comments
@yoyo930021 thanks for looking into this, but unfortunately, it's not fixed. There's still alphabetical ordering going on, but now the other way round. I assume you used my demo repo as a test case. If you rename the folder vetur/server/src/services/dependencyService.ts Lines 260 to 271 in a54c161
Probably the problem is here. I don't really understand the point of the loop :-/ But I think it's fixed by changing |
I will look your case. |
This commit fixes it. This problem is solved when the issue is closed, but it isn't released yet. |
I'm afraid there has been a misunderstanding. I know it's not released yet, I tried your commit from the master branch by building Vetur on my machine. Yes, it fixes the error in the test repo. But when you rename the folder I can create another repo if you want? |
Welcome, I will take a look when free. |
…accidental TS versions from sibling folders) Fixed in upstream, adopted vuejs/vetur#3137
@phil294 Thanks for your help. |
Vetur: Restart VLS
Info
Problem
When you set
"vetur.useWorkspaceDependencies": true
, Vetur will scan your entire workspace for dependencies. Dependencies are not specific to project, asprojectService
importsdependencyService
globally.This is problematic for example when you have an backend and an app folder in your workspace; Vue resides in app. Vetur will scan both folders and you might end up with TS from backend, even though you may have specified a specific TS version in your WEB package.json. If both TS versions have equal dependency path depth, their precedence even relies on their alphabetic ordering, if I figured the code correctly, which is of course random and hard to track down.
Reproducible Case
Here is a repro demo repo: https://github.com/phil294/vetur-dependency-error-demo
If you go into
/app/sfc.vue
, you will find that line 4 (a ||= b
) will show an error. It is TS 4.x syntax.app
has TS 4.x, the unrelatedbackend
uses 3.x.According to extension output channel, these TS versions are being loaded:
backend comes second due to natural ordering, and only the last one is used by Vetur:
vetur/server/src/services/dependencyService.ts
Line 253 in c73f1c4
The text was updated successfully, but these errors were encountered: