this 指向模块范围内的什么地方?

Where does this point to in module scope?

this 在模块范围内引用什么对象(我指的是 node.js 模块)?

console.log(this);
console.log(this === module); //false

它没有引用 module 对象,所以它指向哪里?

奇怪的是,它等于module.exports

console.log(this === module.exports); // => true

就我个人而言,我认为这很愚蠢。但就是这样。

我不知道为什么我们 3 引用了同一件事。 thisexportsmodule.exports 都引用同一个对象。

我最好的猜测是它具有一定的向后兼容性。不过我很容易就错了。