一个使用的例子:https://sourcegraph.com/github.com/nuysoft/Mock/-/blob/src/mock/random/image.js#L252
但是执行的时候会报错:module.require is not a function,相关issue:https://github.com/nuysoft/Mock/issues/222
官方文档里面确实有这个方法(8和10的文档里都有),https://nodejs.org/dist/latest-v8.x/docs/api/modules.html#modules_module_require_id,但是它的使用说明我没看明白:
Note: 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.
有人使用过这个方法吗?如何使用呢?它和require()到底有何区别?