From 32cac37d4fa44d43e7230a7060a0e7587bcbf5f9 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 23 Dec 2021 21:59:26 +0100 Subject: [PATCH 1/2] doc: clarify entry point behavior when using loader hooks Fixes: https://github.com/nodejs/node/issues/41275 --- doc/api/esm.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/esm.md b/doc/api/esm.md index 445b608d9219d8..1cb673cedd7058 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -629,8 +629,8 @@ node b.mjs # works To customize the default module resolution, loader hooks can optionally be provided via a `--experimental-loader ./loader-name.mjs` argument to Node.js. -When hooks are used they only apply to ES module loading and not to any -CommonJS modules loaded. +When hooks are used they apply to the entry point and all `import` calls. They +won't apply to `require` calls that still follows [CommonJS][] rules. ### Hooks From 7d1d79a9b0b842895aef393ee9b456c770a2e41e Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 30 Dec 2021 01:55:18 +0100 Subject: [PATCH 2/2] Update doc/api/esm.md Co-authored-by: Geoffrey Booth <456802+GeoffreyBooth@users.noreply.github.com> --- doc/api/esm.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/esm.md b/doc/api/esm.md index 1cb673cedd7058..7d8decd754b79e 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -630,7 +630,7 @@ To customize the default module resolution, loader hooks can optionally be provided via a `--experimental-loader ./loader-name.mjs` argument to Node.js. When hooks are used they apply to the entry point and all `import` calls. They -won't apply to `require` calls that still follows [CommonJS][] rules. +won't apply to `require` calls; those still follow [CommonJS][] rules. ### Hooks