-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue: Dependency cruiser is unable to correctly resolve aliases defined using "paths" in tsconfig that start with '/' (tsconfig-paths issue) #398
Comments
hi @surgicaI thanks for raising this issue and for preparing the repro-repo. Aliases in tsconfig do work (and there's several unit tests in place to ensure they keep working). In your specific case the As dependency-cruiser should be able to work even with aliases like that, I'll add a unit test with relevant parts of your tsconfig and work from there to see what exactly is throwing that spanner. |
Thanks @sverweij for such a quick response |
@surgicaI Found the root cause: dependency-cruiser uses So this needs to be fixed upstream, or dependency-cruiser needs to start looking for alternatives for tsconfig-paths-webpack-plugin. |
I have the same problem and I am not allowed to change the path structure of the large code base I want to analyse... @sverweij @surgicaI there is a new PR that would fix this upstream problem: dividab/tsconfig-paths#184 |
@slaivyn / @surgicaI - it seems now
... the upstream bug seems to have been fixed. I've bumped the tsconfig-paths-webpack plugin to latest and shipped it in |
We are currently using ViteJS as our devServer, and the condition to define alias there is that it should start with a
forward slash (/)
. If you want to know why is that the case, checkout this link.Thus our paths property in tsconfig.json looks like this
Earlier when we were using the aliases without
/
dependency cruiser was working perfectly fine, eg: defining alias like"@utils/*": ["src/utils/*"],
works.Expected Behavior
Dependency cruiser should be able to resolve the aliases correctly
Current Behavior
It is not able to resolve the aliases correctly. As can be seen from the example shared below to reproduce the issue, it's treating the alias as a separate directory. link
Possible Solution
Not sure.
Steps to Reproduce (for bugs)
Following repo can be used to reproduce the issue
https://github.com/surgicaI/dependency-cruiser-repro
Context
We want to use dependency cruiser to add forbidden dependency tests and due to this bug we are not able to do so.
Your Environment
The text was updated successfully, but these errors were encountered: