module.parent
首先需要这个模块的模块,如果当前模块是当前进程的入口点,则为 null
,如果模块是由不是 CommonJS 模块的东西(例如:REPL 或 import
)加载的,则为 undefined
。
The module that first required this one, or null
if the current module is the
entry point of the current process, or undefined
if the module was loaded by
something that is not a CommonJS module (E.G.: REPL or import
).