juanallo / vscode-dependency-cruiser

vscode extension to generate a dependency graph from any JS file
MIT License
68 stars 18 forks source link

Respect Babel/TS/Webpack/whatever base paths, aliases and externals #4

Open ersinakinci opened 4 years ago

ersinakinci commented 4 years ago

I've configured my tsconfig.json with a baseUrl set to ./app/javascript. So I write import { foo } from 'utility' and it imports from ./app/javascript/utility. Dependency Cruiser, however, sees utility as a top-level import and shows me a graph like this:

Ekran Resmi 2020-09-07 ÖS 5 37 34

It would be really great to see Dependency Cruiser follow Babel/TS/Webpack/whatever's config for base paths and show imports like utility coming from the right place. Here's a non-exhaustive list of details that would need to be addressed:

Perhaps the easiest way to handle the myriad cases is to simply create baseUrl, paths and externals settings in the plugin's config and allow users to manually specify the base path, aliases and any external module declarations.

One last consideration: if you let users declare the base path, they will probably need to give an absolute path since VS Code could be launched from whatever pwd. Not sure whether there's a way around that.

N0tExisting commented 2 years ago

This is also a problem with just importing ts files, as the file-extension is not included

a931528933 commented 2 years ago

hope to implement,This is a massive problem during i use this。

rfgonzalezweb commented 1 year ago

I'm having this issue too with basepaths and aliases, but this is still a great extension :+1: