Answer the question
In order to leave comments, you need to log in
Why require the second call returns an object and not a class?
Good day! There is the following structure of modules:
Module1 acts as the main one, Module2 and Module3 are children, BUT the child modules also recuar each other.
The problem is, in the main module, requare normally connects the child module and returns the class. In the children (apparently the second time) it returns some kind of object.
I read that requare works like requare once and caches everything. Why doesn't it return a class to me, but some kind of object?
Answer the question
In order to leave comments, you need to log in
Cyclic addiction is bad. Get rid of her.
https://nodejs.org/api/modules.html#modules_cycles
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question