-
Notifications
You must be signed in to change notification settings - Fork 251
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
Feature request: Resolve local path aliases in monorepos #565
Comments
Maybe I should use TS projects instead 🤔 [edit] I tried to add a solution tsconfig to the root folder but it doesn't help
|
I'm also interested in this request, ts projects often uses paths to reference other packages. See Nx monorepo etc |
We are also now using For now we are using a patch: diff --git a/node_modules/dependency-cruiser/src/extract/resolve/index.js b/node_modules/dependency-cruiser/src/extract/resolve/index.js
index a877690..62558e7 100644
--- a/node_modules/dependency-cruiser/src/extract/resolve/index.js
+++ b/node_modules/dependency-cruiser/src/extract/resolve/index.js
@@ -26,7 +26,7 @@ function resolveModule(
) {
let lReturnValue = null;
- const lStrippedModuleName = resolveHelpers.stripToModuleName(pModule.module);
+ const lStrippedModuleName = resolveHelpers.stripToModuleName(pModule.module.replace(/^~\//, `${pBaseDirectory}/src/`));
if (
isRelativeModuleName(lStrippedModuleName) ||
["cjs", "es6", "tsd"].includes(pModule.moduleSystem) |
I now managed to solve this without resorting to a patch by using the webpackConfig option with a config file that only provides the |
First of all, thanks for the amazing tool! I find dependency-cruiser extremely helpful in my work.
Context
Here is an example repo that showcases a feature that is used in the one that I would like to analyze.
https://github.com/ertrzyiks/dep-cruiser-ts-monorepo
It is a monorepo and the workspace
a
has a local path aliasImports using this path alias are not resolved.
It works only if I add a global tsconfig.json to the root of the project
Expected Behavior
Imports are resolved using the closest tsconfig.json
Current Behavior
The workspace tsconfig.json is ignored
Possible Solution
Considered alternatives
Run dependency cruiser separately on each workspace
The text was updated successfully, but these errors were encountered: