VS Code Issue with Absolute Path
What I am trying to achieve is to create absolute path aliases in webpack to simplify importing modules.
The code work as expected in Stackblitz web container
https://stackblitz.com/edit/stackblitz-webcontainer-api-starter-u9g2us?file=package.json,src%2FApp.jsx,webpack%2Fwebpack.common.js
But locally in vscode the code work aswell on webpack dev server, but vscode doesn't seem to realize the paths, I have no idea what's wrong? is it intellisense issue in vscode or what?
Any help would be appreciated
2 Replies
Paths within the current project have to start with something like
./
or ../
.
To refer to the project root, Vite (and I assume webpack, somehow) allow the creation of aliases like:
Would let you import stuff from your project as @/components/…
.Thank you. I just found a solution ( or a workaround idk 😂 ) but it worked.
For reference check this comment
https://github.com/facebook/create-react-app/issues/5645#issuecomment-435201019