From 838fb98a3806eb8ca84498c38052b856faf604be Mon Sep 17 00:00:00 2001 From: dynst <148708712+dynst@users.noreply.github.com> Date: Fri, 31 Oct 2025 00:00:00 +0000 Subject: [PATCH] doc: clarify require(esm) description --- 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 4ef79b855bd877..e81fcb637e6950 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"`.