Skip to content
Advertisement

How do you fix this circular dependency issue in node

` I’m getting errors such as Type variable is undefined and getLastUnknownAlbumTrackNumber is not a function

I installed madge to check circular dependencies but I dont know how to resolve them

following is the output from madge

JavaScript

The following are the related imports & exports

jobs/index.js

JavaScript

services/metadata.js

JavaScript

models/index.js

JavaScript

Advertisement

Answer

What do you expect to happen? An attempt to resolve a circular import would result in infinite recursion.

Even if you’re using this tool to check for circular imports, it’s not static analysis, so the code still needs to be run, hence you encounter the same issue.

As a side note, why are you using this tool at all? It’s clear where the circular import lies. You need to refactor to avoid this.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement