Import autocompletes an incorrect path in Visual Studio Code

Viewed 25

I have a TypeScript project and, naturally, when typing import MainLa..., it will autocomplete the import.

However, in this particular project, for some reason the path is usually incorrect.

Regardless of which file I am importing to, I always get a path starting from the root of the project, like this:

import MainLayout from "resources/layouts/MainLayout"

This would be correct, if I was in the root of the project, but I am not.

The correct path would be:

import MainLayout from "../../../resources/layouts/MainLayout"

It seems it is not taking into account the directory I am currently working in.

Where in Visual Studio Code and/or a TypeScript project could I correct this behavior?

There is a tsconfig.json in the root of the project with "rootDir": "./" and "baseUrl": "./".

0 Answers
Related