madge icon indicating copy to clipboard operation
madge copied to clipboard

ts config alias does not work at all

Open Arichy opened this issue 1 year ago • 9 comments

I'm testing this lib, and find some problems. I have a test folder with dependencies:

  • src/index.tsx: ["src/pages/page1/index.tsx"]
  • src/pages/page1/index.tsx: ["src/pages/page1/index.module.scss"]

But when I run yarn build which runs node scripts/build.js, madge listed dependencies of src/index.tsx as an empty array instead of including src/pages/page1/index.tsx

with extends in tsconfig: image

without extends in tsconfig: image

Arichy avatar Jan 20 '24 05:01 Arichy

I installed madge globally, manually updated dependencies dependency-tree and detective-typescript, and seems it solves my task with tsconfig aliases

Delagen avatar Jan 31 '24 06:01 Delagen

I had a similar issue and I managed to fix it by adding "baseUrl": "." to my tsconfig.json (despite this option being deprecated: https://www.typescriptlang.org/tsconfig#baseUrl)

guillaumebrunerie avatar Jan 31 '24 11:01 guillaumebrunerie

I had a similar issue and I managed to fix it by adding "baseUrl": "." to my tsconfig.json (despite this option being deprecated: https://www.typescriptlang.org/tsconfig#baseUrl)

But there are already baseUrl : "src" in my config.

Arichy avatar Feb 02 '24 13:02 Arichy

I installed madge globally, manually updated dependencies dependency-tree and detective-typescript, and seems it solves my task with tsconfig aliases

What are the respective versions did you update to manually?

Arichy avatar Feb 02 '24 14:02 Arichy

I installed madge globally, manually updated dependencies dependency-tree and detective-typescript, and seems it solves my task with tsconfig aliases

What are the respective versions did you update to manually?

Simply latest

Delagen avatar Feb 02 '24 15:02 Delagen

I installed madge globally, manually updated dependencies dependency-tree and detective-typescript, and seems it solves my task with tsconfig aliases

What are the respective versions did you update to manually?

Simply latest

that's not work for me ... and adding "baseUrl": "." to tsconfig.json work

huntye1 avatar Feb 18 '24 09:02 huntye1

I installed madge globally, manually updated dependencies dependency-tree and detective-typescript, and seems it solves my task with tsconfig aliases

What are the respective versions did you update to manually?

Simply latest

that's not work for me ... and adding "baseUrl": "." to tsconfig.json work

Finally, i solved this problem with option basedir. Cause I run madge cmd in another package dir of monorepo, it work right

huntye1 avatar Feb 19 '24 10:02 huntye1

@huntye1 I always set this option)

Now it work from the box or need to update dependencies?

Delagen avatar Feb 19 '24 11:02 Delagen

I think I'm running into the same issue, what did you set basedir to that solved it? Madge works with vue as well unless I run madge from outside the project's directory.

dyllandry avatar Jul 11 '24 23:07 dyllandry