When main.js loads a.js, then a.js in turn loads b.js. At that point, b.js tries to load a.js. In order to prevent an infinite loop, an unfinished copy of the a.js exports object is returned to the b.js module. b.js then finishes loading, and itsexports object is provided to the a.js module.
By the time main.js has loaded both modules, they're both finished. The output of this program would thus be:
https://nodejs.org/api/all.html#all_cycles
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
ringa_lee