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

Doesn't detect circular dependency when ./ is in module path #33

Closed
apaatsio opened this issue Jul 9, 2014 · 5 comments
Closed

Doesn't detect circular dependency when ./ is in module path #33

apaatsio opened this issue Jul 9, 2014 · 5 comments

Comments

@apaatsio
Copy link

apaatsio commented Jul 9, 2014

Problem:

It says no circular dependencies even though there is one.

To reproduce:

Directory structure

a.coffee
foo/b.coffee

a.coffee:

define 'a', ['./foo/b'], ->

b.coffee:

define 'foo/b', ['a'], ->

Now run madge --circular --format amd ./ and notice that it doesn't detect the circular dependency.

If you remove the ./ from a.coffee it detects the circularity.

I noticed this on Windows. I didn't have time yet to try on *nix.

@pahen pahen closed this as completed in 44e6ef2 Jul 11, 2014
@pahen
Copy link
Owner

pahen commented Jul 11, 2014

Thanks for a good bug report! I have fixed it in v.0.3.3 now.

@apaatsio
Copy link
Author

Cool, thanks for the prompt fix!

@RoyalBingBong
Copy link

RoyalBingBong commented Oct 28, 2019

I think this one back!
This example will say it does not have cyclic dependencies:
index.ts

export class Bar {}

export * from './foo';

foo.ts

import { Bar } from './';

export class Foo extends Bar {}

If I change import { Bar } from './'; to import { Bar } from './index'; then --circular correctly shows that I have a circular dependency.

Edit: Seems to only be the case for Typescript.

@pahen
Copy link
Owner

pahen commented Oct 28, 2019

Do you include your tsconfig with the --ts-config option when using Madge @RoyalBingBong ?

@RoyalBingBong
Copy link

Oh, I did not.
I tried again with the example from above and a default tsconfig.json from tsc --init and the circular dependency detection seems to work just fine.

nmeylan pushed a commit to nmeylan/madge that referenced this issue Jan 7, 2020
…ead of substack’s resolve lib since it works as expected (fixes pahen#33).
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

3 participants