I\'m working with Webpack and Visual Studio Code and in order to avoid things like:
import { AuthenticationService } from \'../../../services/authentication/
Install VSCode extension PathIntellisense .
To open your VSCode setting file, you can press command+, on macOS(on Windows is ctrl+,), find "a pair of curly brackets button" on the top right corner, click it.
In my situation, I want to use the symbol @
as an alias of the path ./src
. So I add this configuration to my VSCode setting file:
"path-intellisense.mappings": {
"@": "${workspaceRoot}/src"
}
Use ${workspaceRoot}
when the path should be relative to the current root of the current project.
You can find the official example here .
Original answer:
I use the VSCode extension PathIntellisense .
Configure this setting in my VSCode setting file.
Now VSCode could recognize the path with the alias.