This is a followup to vscode issue #16320, to which vscode dev Matt Bierner suggests I ask here.
Recent versions of VS Code...
jsconfig.json
configuration) webpack aliases, a webpack feature enabling prefixes for import lines for friendlier imports (see vscode documentation for Webpack aliases). For example, aliasing /src/api
to *
will let me type import foo from */users
instead of import foo from ../../../../src/api/users
.But in some uses cases, they fail together. I built a minimal broken test project (zip, 3kB) for my use case. Can anyone give a look at it and see if I'm doing anything wrong or if it looks like a bug?
Extract the zip and see README.md
: path autocompletion works, but not "peek" or "Go to definition".
npm install && npm run build && node dist/index.js
→ Install & build both succeed, indicating Webpack is happy. Run logs [1, 2, 3]
.code /path/to/project
and open src/index.js
On line 5, try to F12 on getLinks
→ No definition found for 'getLinks'
😢Am I still doing something wrong in my jsconfig.json
, or is this a bug? (the multiple levels of exports, maybe?)
Accepted answer is correct, except my solution was simply:
import something from '~/something';
jsconfig.json
looks like this:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"~/*": ["./*"]
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With