module.require(id)


module.require() 方法提供了一种加载模块的方式,就好像从原始模块中调用了 require() 一样。

【The module.require() method provides a way to load a module as if require() was called from the original module.】

为了做到这一点,有必要获取对 module 对象的引用。由于 require() 返回的是 module.exports,而 module 通常仅在特定模块的代码中可用,因此必须显式导出它才能使用。

【In order to do this, it is necessary to get a reference to the module object. Since require() returns the module.exports, and the module is typically only available within a specific module's code, it must be explicitly exported in order to be used.】