-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
VSCode "auto import" of ESM module broken in 2.6.11 with umd namespace #11009
Comments
You should import it from vue-property-decorator like It looks like Vue is automatically imported within VSCode as creating an empty vue file already allows you to use Vue with correct typings, so I imagine it would make sense for the IDE to not be able to import automatically. I don't know if this is something we can improve. @octref do you know if this is possible to change here or somewhere else? |
Does this happen for TS file as well? |
yes |
I cannot reproduce it with the exact same versions of Vue, VSCode and TypeScript. Could you provide example project reproducing the issue as GitHub repo? |
I reproduced it with the cli by creating a project with babel + ts and upgrading ts to its latest version (but it appears on 3.5.3 too) |
vue-property-decorator simply re-export a named Vue from the default export of the 'vue' package. There are a lot of case in typescript when you don't you use the decorator (in a Vuex store for example) and don't want to import Vue fromthe vue-property-decorator package (ie. code splitting) I dont know if it's VSCode or TSServer related but the auto-import suggesting was always |
Can you please be more precise, for example, I did this and it doesn't reproduce for me: mkdir foo
cd foo
yarn add vue vue-property-decorator
touch test.ts
code .
|
@octref from you example if you add Typescript you will have the auto-import suggesting by clicking on the 💡 from VSCode. here's how i reproduced it using minimal deps (not the vue-cli)
inside TestVue.ts
The named import work i still get the suggestion to import from 'vue' But the default import do not appear If i revert back to 2.6.10 i get the correct suggestion from the 'vue' Maybe it's a TSServer issue 😕 .. but because some of my dev on my team just use the suggested import regardless, i had to revert back to 2.6.10 |
Thanks, I can repro now, but this is not a Vetur problem, but a Vue types / TS Server issue. |
Version
2.6.11
Reproduction link
https://imgur.com/a/RxJz6fT
Steps to reproduce
Since the 2.6.11 my IDE (VSCode) now suggest me import Vue from the 'vue/types/umd' namespace instead of the ESModule 'vue'
I'm using
Vue 2.6.11
Vue-CLI 4.1.0
VScode 1.41.1
Typescript 3.7.4
What is expected?
Prior 2.6.11, VScode was suggesting to
import Vue from 'vue'
What is actually happening?
VSCode is suggesting me to
import Vue from 'vue/types/umd'
see screenshotmaybe it's releated to #9912 ?
The text was updated successfully, but these errors were encountered: