DEP0138: process.mainModule


类型: 仅文档

process.mainModule 是 CommonJS 独有的特性,而 process 全局对象与非 CommonJS 环境共享。 不支持在 ECMAScript 模块中使用它。

它已被 require.main 弃用,因为它具有相同的目的并且仅在 CommonJS 环境中可用。

Type: Documentation-only

process.mainModule is a CommonJS-only feature while process global object is shared with non-CommonJS environment. Its use within ECMAScript modules is unsupported.

It is deprecated in favor of require.main, because it serves the same purpose and is only available on CommonJS environment.