madge icon indicating copy to clipboard operation
madge copied to clipboard

import "./package.js" is treated the same as "package"

Open UtkarshVerma opened this issue 1 year ago • 3 comments

I just ran into a rare edge case where madge is resolving ./package.js and package (from npm) to be the same. This gave me weird cyclic dependencies when there were actually none.

This is in the context of a Typescript codebase strictly using ES6 syntax.

UtkarshVerma avatar May 27 '23 12:05 UtkarshVerma

I'm having the same issue. I have a file src/mocks/msw.ts that is importing the node module msw (./node_modules/msw/lib/index) and is producing a false positive for a circular import.

If I rename the file to mswSetup.ts no circular dependencies are reported.

cpoliver-perenna avatar Jun 05 '23 13:06 cpoliver-perenna

Thanks for sharing and maintaining the library 🤗

Just wanted to report we've faced the same issue. We had a file named jimp.ts with the below:

import jimp from 'jimp'

Madge was pointing out as if we had a new circular dependency in the project.

image

After debugging, we've found this open issue and worked around it by renaming the file from jimp.ts to jimp-helper.ts

Maybe we can contribute to fixing the issue. It'd just be great to have a hint as to where to get started.

fwuensche avatar Aug 07 '23 13:08 fwuensche

Also hitting this (a file called styles/react-select.ts for styling our react-select components). Easy to work around, but annoying.

adamsmasher avatar Mar 27 '24 03:03 adamsmasher