We're using madge to analyze the dependency tree within our monorepo. It works well for identifying dependencies at the package level.
However, we encounter an issue when using barrel files for re-exports.
Consider the following project structure
* app-1
* src
* App.ts
* app1Utils.ts
* libraries
* common-util #( package name as per package.json = @org-web/common-util)
* src
* index.ts
* utils
* helper.ts
In libraries/common-util/index.ts we have
export { helper } from './utils/helper.ts'
Inside my app-1/src/App.ts, we have
import { helper } from '@org-web/common-util';
import { app1Utils } from './app1Utils.ts';
// statements list for execution
helper(/** List of arguments */);
The desired outcome is for madge to identify the actual dependency: libraries/common-util/src/utils/helper.ts. But it always resolves to index.ts file of that package. Is there a possibility with madge to even resolve this barrel files and give us the specific file reference even if it is reexported?
Hi Madge team,
We're using
madge
to analyze the dependency tree within our monorepo. It works well for identifying dependencies at the package level. However, we encounter an issue when using barrel files for re-exports. Consider the following project structureIn
libraries/common-util/index.ts
we haveInside my
app-1/src/App.ts
, we haveRunning
madge
onapp-1
, currently showsThe desired outcome is for madge to identify the actual dependency:
libraries/common-util/src/utils/helper.ts
. But it always resolves to index.ts file of that package. Is there a possibility with madge to even resolve this barrel files and give us the specific file reference even if it is reexported?