VSCode "auto import" of ESM module broken in 2.6.11 with umd namespace
See original GitHub issueVersion
2.6.11
Reproduction link
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 screenshot
maybe it’s releated to https://github.com/vuejs/vue/pull/9912 ?
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (8 by maintainers)
Top Results From Across the Web
VS Code auto import using require instead of importing ES ...
Anytime I create a JS file, it is considered a CommoJS Module instead of an ES Module. And if I try to import...
Read more >Auto import | WebStorm Documentation - JetBrains
Basic procedures to create and optimize imports in WebStorm. Learn more how to import the missing import or XML namespace.
Read more >Visual Studio Code Extension - Auto Import - YouTube
Visual Studio Code Extension - Auto ImportIn this video, we take a look at the Auto Import extension within Visual Studio Code.
Read more >Auto Import | PHP Tools for Visual Studio Documentation
Importing classes, functions, and constants from outside the namespace.
Read more >PHP Namespace Resolver - Visual Studio Marketplace
Extension for Visual Studio Code - Import and expand php namespaces.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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
You should import it from vue-property-decorator like
import { Component, Vue } from 'vue-property-decorator'
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?