@@ -18,27 +18,27 @@ index 1931688e85d05ee2da4f88efb05d635cb43be233..afccc24392abff9eef2b9953fcffeb79
1818
1919 /**
2020diff --git a/lib/internal/modules/esm/load.js b/lib/internal/modules/esm/load.js
21- index 6f9b73abd8a76191714f12d68c01a881653d8d4a..f108b567a910805ff86f0baf75fa1a6102ad28d6 100644
21+ index 5239bc8ed883a54df206d73c5dc0b70942c4f3df..a111b5d7a6084caa61deb56bace5d91bf5f5aff4 100644
2222--- a/lib/internal/modules/esm/load.js
2323+++ b/lib/internal/modules/esm/load.js
24- @@ -140 ,7 +140 ,7 @@ async function defaultLoad(url, context = kEmptyObject) {
25- // Now that we have the source for the module, run `defaultGetFormat` again in case we detect ESM syntax .
26- format ?? = await defaultGetFormat(urlInstance, contextToPass );
24+ @@ -142 ,7 +142 ,7 @@ async function defaultLoad(url, context = kEmptyObject) {
25+ // Now that we have the source for the module, run `defaultGetFormat` to detect its format .
26+ format = await defaultGetFormat(urlInstance, context );
2727
28- - if (format === 'commonjs' && contextToPass !== context ) {
29- + if (( format === 'commonjs' || format === 'electron') && contextToPass !== context ) {
30- // For backward compatibility reasons, we need to discard the source in
31- // order for the CJS loader to re-fetch it.
32- source = null;
33- @@ -221 ,6 +221 ,7 @@ function throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports) {
28+ - if (format === 'commonjs') {
29+ + if (format === 'commonjs' || format === 'electron') {
30+ // For backward compatibility reasons, we need to discard the source in
31+ // order for the CJS loader to re-fetch it.
32+ source = null;
33+ @@ -224 ,6 +224 ,7 @@ function throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports) {
3434 protocol !== 'file:' &&
3535 protocol !== 'data:' &&
3636 protocol !== 'node:' &&
3737+ protocol !== 'electron:' &&
3838 (
3939 !experimentalNetworkImports ||
4040 (
41- @@ -229 ,7 +230 ,7 @@ function throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports) {
41+ @@ -232 ,7 +233 ,7 @@ function throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports) {
4242 )
4343 )
4444 ) {
0 commit comments