@@ -6,27 +6,18 @@ Subject: fix: do not resolve electron entrypoints
6
6
This wastes fs cycles and can result in strange behavior if this path actually exists on disk
7
7
8
8
diff --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
10
10
--- a/lib/internal/modules/esm/load.js
11
11
+++ 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;
13
14
format ??= 'builtin';
14
- } else {
15
- let contextToPass = context;
15
+ } else if (format !== 'commonjs' || defaultType === 'module') {
16
16
- if (source == null) {
17
17
+ if (format !== 'electron' && source == null) {
18
18
({ responseURL, source } = await getSource(urlInstance, context));
19
- contextToPass = { __proto__: context, source };
19
+ context = { __proto__: context, source };
20
20
}
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;
30
21
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
31
22
index dbbe37474c70addfbf8cf805c29732dcd38c74f6..96ffb2b0b051163d8a777ed3d1b5bc2c83fc37c5 100644
32
23
--- a/lib/internal/modules/esm/translators.js
0 commit comments