最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Node.js source code of require() function - Stack Overflow

programmeradmin0浏览0评论

According to the document (.html), require() function is one of the global objects/functions. But I'm having a hard time finding its source code on Github. Are they written in JS or C++? I was looking for them in project.

According to the document (https://nodejs/api/globals.html), require() function is one of the global objects/functions. But I'm having a hard time finding its source code on Github. Are they written in JS or C++? I was looking for them in https://github./nodejs/node project.

Share Improve this question asked Dec 18, 2018 at 4:46 thinkbotthinkbot 5231 gold badge5 silver badges10 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

This seems to be it (in node/lib/internal/modules/cjs/helpers.js).

To answer my own question, I think it's defined in loader.js. And you can see it's implemented for all modules. It seems to be mapped to global.require in node.js

发布评论

评论列表(0)

  1. 暂无评论