CommonJS规范中是这样描述循环依赖的--http://www.commonjs.org/specs/modules/1.0/
If there is a dependency cycle, the foreign module may not have finished executing at the time it is required by one of its transitive dependencies; in this case, the object returned by "require" must contain at least the exports that the foreign module has prepared before the call to require that led to the current module's execution.
下面我们来理解一下:
cyclemain.js
console.log("main导入a模块");
const a = require('./cycleA');
console.log("main输出a模块----");
console.log(a)
cycleA.js
console.log('a模块--导入b之前')
const b = require('./cycleB');
console.log("a输出B模块----");
console.log(b)
console.log('a模块--导入b之后')
module.exports = '我是A模块'