diff --git a/doc/api/modules.md b/doc/api/modules.md index 86f5df057e9..9e4d3a223b8 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -318,6 +318,8 @@ experimental and can be disabled using `--no-experimental-require-module`. When `require()` actually encounters an ES module for the first time in the process, it will emit an experimental warning. The warning is expected to be removed when this feature stablizes. +This feature can be detected by checking if +[`process.features.require_module`][] is `true`. ## All together @@ -1280,6 +1282,7 @@ This section was moved to [`node:test`]: test.md [`package.json`]: packages.md#nodejs-packagejson-field-definitions [`path.dirname()`]: path.md#pathdirnamepath +[`process.features.require_module`]: process.md#processfeaturesrequire_module [`require.main`]: #requiremain [exports shortcut]: #exports-shortcut [module resolution]: #all-together diff --git a/doc/api/process.md b/doc/api/process.md index 0008ecbbc01..73d514f1f4a 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -1936,6 +1936,17 @@ added: v0.5.3 A boolean value that is `true` if the current Node.js build includes support for IPv6. +## `process.features.require_module` + + + +* {boolean} + +A boolean value that is `true` if the current Node.js build supports +[loading ECMAScript modules using `require()`][]. + ## `process.features.tls`