Skip to content
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

Listing dependancy tree via madge always gives me the reference from barel files #426

Open
karthickshanmugam0689 opened this issue Jun 10, 2024 · 1 comment

Comments

@karthickshanmugam0689
Copy link

karthickshanmugam0689 commented Jun 10, 2024

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 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 */);

Running madge on app-1, currently shows

{
   'App.ts': [
      '../../libraries/common-util/src/index.ts',
      './app1Utils.ts'
   ]
}

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?

@karthickshanmugam0689
Copy link
Author

Hi Team,
Do we have any update here? We would like to also resolve barrel files here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant