Vetur Cannot Find Module From @ when in Parent Folder

39 Views Asked by At

Overview

I'm building a front end project using Vue, Vetur, and Typescript. When I create imports in files such as App.vue, my @ alias for the src folder works perfectly if I open the folder my_project which contains the package.json and tsconfig.json in VsCode.

Problem

However, if I open the parent folder of my_project, then Vetur complains with a red squiggle that the module cannot be found. Relative imports still work perfectly. I suspect that this is an issue with the paths variable in my tsconfig.json. I have tried adding ./my_project/src/*, but this doesn't make any difference. Any help would be appreciated.

Files

App.vue import:

import { Testing } from '@/Testing

tsconfig.json paths:

"paths": {
   "@/*": ["./src/*", "./my_project/src/*"]
}
0

There are 0 best solutions below