상세 컨텐츠

본문 제목

[Vue.js3, typescript] vue typescript Cannot find module './App.vue' or its corresponding type declarations.

FrontEnd/Vue.js

by SangHoonE 2023. 1. 16. 15:21

본문

반응형

도움이 되셨다면 광고 한번 클릭해주세요. 블로그 운영에 큰 힘이 됩니다. 감사합니다.

안녕하세요 상훈입니다.

 

✔ 환경

이번 에러는 에러라고 하기에는 애매하고, VSCode를 사용할 때에 발생할 수 있는 내용입니다.

/scr/main.ts

프로젝트는 잘 구동되지만, 에러가 신경쓰였습니다.

Cannot find module './App.vue' or its corresponding type declarations.

src/main.ts 에서 [ import App from '@/App.vue' ] 부분에 밑줄이 그어지면서 에러라고 표기되었습니다.

 

✔ 해결방법

extensions - @builtin typescript - 설정(settings) - Disable(workspace) 를 해줍니다. 

그리고 reload VSCode! 

이제 빨간 에러문구가 뜨지않는것으로 확인하였습니다.

하고난 후 project reload!

 

✔ 원인

extension이 .vue 파일을 제대로 읽어내지 못하기 때문인 것으로 보입니다.

 

진짜 별거 아닌데, 신경쓰여서..

 

이상입니다.

 

 

VSCode showing "cannot find module" TS error for .vue import while compiling doesn't

Simply put, vscode is showing this error in a module: Cannot find module '@/components/SidebarToggleIcon' But no such error shows up during compilation. This is a VueJS project and SidebarTogg...

stackoverflow.com

 

관련글 더보기

댓글 영역