@@ -6,27 +6,18 @@ Subject: fix: do not resolve electron entrypoints
66This wastes fs cycles and can result in strange behavior if this path actually exists on disk
77
88diff --git a/lib/internal/modules/esm/load.js b/lib/internal/modules/esm/load.js
9- index 8406e8ca319533d6186c5d457e951b7a845b6b72..caa34187e17d9a0addcc8c94e46823ea4e05c590 100644
9+ index 1d94cbeb771375243f58e544c583f612c3f4385c..97146f38a5478afeaded03c16e44ffb56fbe8087 100644
1010--- a/lib/internal/modules/esm/load.js
1111+++ b/lib/internal/modules/esm/load.js
12- @@ -131,7 +131,7 @@ async function defaultLoad(url, context = kEmptyObject) {
12+ @@ -132,7 +132,7 @@ async function defaultLoad(url, context = kEmptyObject) {
13+ source = null;
1314 format ??= 'builtin';
14- } else {
15- let contextToPass = context;
15+ } else if (format !== 'commonjs' || defaultType === 'module') {
1616- if (source == null) {
1717+ if (format !== 'electron' && source == null) {
1818 ({ responseURL, source } = await getSource(urlInstance, context));
19- contextToPass = { __proto__: context, source };
19+ context = { __proto__: context, source };
2020 }
21- @@ -139,7 +139,7 @@ async function defaultLoad(url, context = kEmptyObject) {
22- // Now that we have the source for the module, run `defaultGetFormat` again in case we detect ESM syntax.
23- format ??= await defaultGetFormat(urlInstance, contextToPass);
24-
25- - if ((format === 'commonjs' || format === 'electron') && contextToPass !== context) {
26- + if (format === 'electron' || format === 'commonjs' && contextToPass !== context) {
27- // For backward compatibility reasons, we need to discard the source in
28- // order for the CJS loader to re-fetch it.
29- source = null;
3021diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
3122index dbbe37474c70addfbf8cf805c29732dcd38c74f6..96ffb2b0b051163d8a777ed3d1b5bc2c83fc37c5 100644
3223--- a/lib/internal/modules/esm/translators.js
0 commit comments