根据文档 ( https://nodejs.org/api/globals.html ),require()
函数是全局对象/函数之一。但是我很难在 Github 上找到它的源代码。它们是用 JS 还是 C++ 编写的?我在 https://github.com/nodejs/node 中寻找它们项目。
最佳答案
This似乎是这样(在 node/lib/internal/modules/cjs/helpers.js
中)。
关于javascript - require()函数的Node.js源码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53826529/