From 106e398e3700fb5a60633dc8403fe49cc46d32b4 Mon Sep 17 00:00:00 2001 From: lazerg Date: Tue, 3 Nov 2026 07:28:47 +0500 Subject: [PATCH 1/2] doc: note importAttributes is undefined for require Signed-off-by: lazerg --- doc/api/module.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/api/module.md b/doc/api/module.md index f86167e8d44f..222695971c1f 100644 --- a/doc/api/module.md +++ b/doc/api/module.md @@ -933,8 +933,9 @@ changes: * `specifier` {string} * `context` {Object} * `conditions` {string\[]} Export conditions of the relevant `package.json` - * `importAttributes` {Object} An object whose key-value pairs represent the - attributes for the module to import + * `importAttributes` {Object|undefined} An object whose key-value pairs + represent the attributes for the module to import, or `undefined` if the + module is loaded by `require()` * `parentURL` {string|undefined} The module importing this one, or undefined if this is the Node.js entry point * `nextResolve` {Function} The subsequent `resolve` hook in the chain, or the @@ -1024,7 +1025,8 @@ changes: * `format` {string|null|undefined} The format optionally supplied by the `resolve` hook chain. This can be any string value as an input; input values do not need to conform to the list of acceptable return values described below. - * `importAttributes` {Object} + * `importAttributes` {Object|undefined} `undefined` if the module is loaded + by `require()` * `nextLoad` {Function} The subsequent `load` hook in the chain, or the Node.js default `load` hook after the last user-supplied `load` hook * `url` {string} From 1c34c137a907b9e6290d81bdfc8b0fe496496124 Mon Sep 17 00:00:00 2001 From: lazerg Date: Tue, 3 Nov 2026 07:30:39 +0500 Subject: [PATCH 2/2] doc: cover CommonJS entry points too Signed-off-by: lazerg --- doc/api/module.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/api/module.md b/doc/api/module.md index 222695971c1f..67f9643a6dd2 100644 --- a/doc/api/module.md +++ b/doc/api/module.md @@ -935,7 +935,7 @@ changes: * `conditions` {string\[]} Export conditions of the relevant `package.json` * `importAttributes` {Object|undefined} An object whose key-value pairs represent the attributes for the module to import, or `undefined` if the - module is loaded by `require()` + module is loaded by the CommonJS loader (for example, through `require()`) * `parentURL` {string|undefined} The module importing this one, or undefined if this is the Node.js entry point * `nextResolve` {Function} The subsequent `resolve` hook in the chain, or the @@ -1025,8 +1025,9 @@ changes: * `format` {string|null|undefined} The format optionally supplied by the `resolve` hook chain. This can be any string value as an input; input values do not need to conform to the list of acceptable return values described below. - * `importAttributes` {Object|undefined} `undefined` if the module is loaded - by `require()` + * `importAttributes` {Object|undefined} The import attributes of the module, + or `undefined` if the module is loaded by the CommonJS loader (for example, + through `require()`) * `nextLoad` {Function} The subsequent `load` hook in the chain, or the Node.js default `load` hook after the last user-supplied `load` hook * `url` {string}