'TypeScript 'cannot find module...' in Vue project
I'm using TypeScript in Vue project.
But when I try to import vue file, I can't get .vue file since the 'cannot find module...' error.
What is weird is that intellisense only shows the directory right upper the .vue file.
Intellisense shows the directory well
But it doesn't show the .vue file inside it
I also have vue-shim.d.ts file in root directory.
Solution 1:[1]
Try adding the following into index.d.ts in the project root, works for now.
declare module '*.vue' {
import Vue from 'vue'
export default Vue
}
or try to configure the path in tsconfig with
"paths": { "@/*":["./src/*"] }
or edit includes in tsconfig with
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ahmed Malek |

