question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When import .vue inside .js file it gives module not found in vscode

See original GitHub issue
  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: Win
  • Vetur version: 0.21.0
  • VS Code version: 1.35.0

Problem

When .vue file is imported from .js file and checkJs is true in jsconfig.json file vscode gives error that it can’t find module even though .vue extension is included in the import please check the screenshot.

vetur-problem

Reproducible Case

Just create new app using vue-cli and in main.js try to ctrl + click on App.vue import it doesn’t take me to the App.vue file.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
yoyo930021commented, Jun 9, 2019

When use .ts or .js files, VSCode use typescript-language-server in VSCode built-in. It don’t know .vue file, It use vue-shims.d.ts file to know.

When use .vue files, VSCode use vue-language-server in vetur. It can know .vue file by itself, so can get more info.

The above is my guess.

2reactions
sagarrabadiyacommented, Jun 8, 2019

@yoyo930021 here is the jsconfig.json content

{
  "include": ["./src/**/*"],
  "compilerOptions": {
    "module": "es6",
    "moduleResolution": "node",
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    },
    "checkJs": true
  },
  "exclude": ["node_modules"]
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

VSCode showing "cannot find module" TS error for .vue import ...
In your project workspace, bring up the command palette with Ctrl + Shift + P (macOS: Cmd + Shift + P). Type built...
Read more >
[Solved]-VSCode not properly importing my main.js file-Vue.js
Coding example for the question VSCode not properly importing my main.js file-Vue.js.
Read more >
Vue JavaScript Tutorial in Visual Studio Code
Vue JavaScript tutorial showing IntelliSense, debugging, and code navigation support in the Visual Studio Code editor.
Read more >
Using Vue with TypeScript - Vue.js
Volar is the official VSCode extension that provides TypeScript support inside Vue SFCs, along with many other great features.
Read more >
Create a Vue.js app using Node.js - Visual Studio (Windows)
For .vue files, you need to use WebPack or a similar framework with a loader to do the conversion. TypeScript and Visual Studio...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found