From 62889d7e992ec7cae28cf4a0b308724fbaf72a96 Mon Sep 17 00:00:00 2001 From: dynst <148708712+dynst@users.noreply.github.com> Date: Sun, 2 Nov 2025 15:58:17 -0500 Subject: [PATCH] doc: clarify require(esm) description PR-URL: https://github.com/nodejs/node/pull/60520 Reviewed-By: Joyee Cheung Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Chemi Atlow --- doc/api/modules.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/api/modules.md b/doc/api/modules.md index 4ef79b855bd..e81fcb637e6 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -255,9 +255,8 @@ This property is experimental and can change in the future. It should only be us by tools converting ES modules into CommonJS modules, following existing ecosystem conventions. Code authored directly in CommonJS should avoid depending on it. -When an ES Module contains both named exports and a default export, the result returned by `require()` -is the [module namespace object][], which places the default export in the `.default` property, similar to -the results returned by `import()`. +The result returned by `require()` is the [module namespace object][], which places +the default export in the `.default` property, similar to the results returned by `import()`. To customize what should be returned by `require(esm)` directly, the ES Module can export the desired value using the string name `"module.exports"`.