Typescript - TSConfig path is not taken into account
See original GitHub issueFeature Request
Expected Behavior
I want to create the dependency graph of my project.
My project structure is like this: src/
- main.ts
-
- core/
-
-
- magicalFile.ts
-
I am using in the “paths” option the TSConfig.json to create shortcuts for my imports.
relevant parts of tsconfig.json:
{
...
"baseUrl": "src",
"paths": {
"@core/*": ["core/*"],
}
...
}
in my main file “main.ts” i am importing other files with the shortcut.
import { MagicalClass } from '@core/magicalFile'
Now i try to create a dependency table.
dependency-cruiser -v -T html -f dependencyGraph.html ./src/main.ts
I would expect, that dependency-cruiser will take those settings in the tsconfig.json into account and follow the import shortcuts.
Current Behavior
Dependency-cruiser does not take the tsconfig settings into account and try´s to find
@core/magicalFile.ts
in the directory @core. Which does not exist.
As a result the dependency graph ends at main.ts
and only shows some not resolvable imports.
Possible Solution
It would be nice if, for typescript files, the path option in the tsconfig.json would be taken into account.
Context
For projects wit a certain size, the path-option helps to reduce the length of import statements and to make them more readable.
Your Environment
- Version used: 4.3.2
- Node version: 8
- Operating System and version: Windows 10
Thank you in advance and warm regards
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (6 by maintainers)
Top GitHub Comments
Works like a charm.
Version
4.4.0
, which contains the merged PR’s now is on npm. I assume this closes the issue - let me know if you think otherwise.