I have a JS project with babel configuration, and it's configured to support relative paths. Instead of doing this:
import Class from '../../../../somePath/Class';
Writing the code in a more clean way:
import Class from 'app/somePath/Class';
babel.config.js
const plugins = [
[require('babel-plugin-module-resolver'), { root: ["./app/"] }],
];
That's all great, but I struggle with navigation trough files. For example when using CMD+Click on path, to navigate to file doesn't work on relative paths.
Is there a way to support navigations for relative paths in VSCode?
UPDATE
I tried the method suggested by @rioV and add HTML Related Links configuration to my project:
myapp/.vscode/settings.json
Added the following to project settings:
"html-related-links.include": {
"javascript": [
{ "find": "import [^ ]+ from '((?=app/).+?)';", "filePath": "/$1.js" },
{ "find": "import [^ ]+ from '((?!app/).+?)';", "filePath": "$1.js" }
]
},
User/settings.json
Also have included html-related-links.alwaysShow to true in the User settings:
"html-related-links.alwaysShow": true,
"html-related-links.fileroot": [
"./app"
],
And still doesn't seem to navigate when clicking the file path.