In ES6 (like node), importing a module like this
import something from 'something';
Is the same as
import something from 'something/index';
However, vscode appears incapable of performing "Go To Definition" if importing modules using the first method. If I append index, "Go To Definition" works. Is there a way to modify jsconfig.json to have vscode check the index file by default?
1 Answers
Answers 1
I asked this question on github and received this response from Matt Bierner (Microsoft).
Does your project have a jsconfig.json? Can you make sure it contains the setting:
{ "compilerOptions": { "module": "commonjs" } }
Adding the above configuration to my jsconfig.json seems to have fixed the issue even though I'm using ES6 import and export syntax.
However this shouldn't be an issue since,
In a jsconfig, the module option only changes how paths are resolved
0 comments:
Post a Comment