Checking for circular module dependencies?

Hi, I’m wondering if there is some way to detect whether there are circular dependencies in a set of modules. Ideally, it might look something like this:

let detectCircularDependencies = fileNames => { … } 

// then i'd call

detectCircularDependencies('./a.js', './b.js', './c.js')
Circular dependency found: a.js > b.js > c.js > a.js


Or something like that.
Was this page helpful?