@@ -6,19 +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/run_main.js b/lib/internal/modules/run_main.js
9
- indexdaaa153516c424334c18b5dfa35e0e55e1fbcce4..6181cc21bf303c41ed9c65681a34f6393223fb67 100644
9
+ index0bfe7b11241416bfca0d470047b14777ad99307f..c86add4395ed59cee0d880961e7572b0cc3d6698 100644
10
10
--- a/lib/internal/modules/run_main.js
11
11
+++ b/lib/internal/modules/run_main.js
12
- @@ -3,6 +3,7 @@
12
+ @@ -2,12 +2,19 @@
13
+
13
14
const {
14
- ObjectCreate,
15
15
StringPrototypeEndsWith,
16
16
+ StringPrototypeStartsWith,
17
17
} = primordials;
18
- const CJSLoader = require('internal/modules/cjs/loader');
19
- const { Module, toRealPath, readPackageScope } = CJSLoader;
20
- @@ -13,6 +14,13 @@ const {
21
- } = require('internal/modules/esm/handle_process_exit');
18
+
19
+ const { getOptionValue } = require('internal/options');
20
+ const path = require('path');
22
21
23
22
function resolveMainPath(main) {
24
23
+ // For built-in modules used as the main entry point we _never_
@@ -27,11 +26,10 @@ index daaa153516c424334c18b5dfa35e0e55e1fbcce4..6181cc21bf303c41ed9c65681a34f639
27
26
+ if (typeof main === 'string' && StringPrototypeStartsWith(main, 'electron/js2c')) {
28
27
+ return main;
29
28
+ }
30
- +
31
29
// Note extension resolution for the main entry point can be deprecated in a
32
30
// future major.
33
31
// Module._findPath is monkey-patchable here.
34
- @@ -28 ,6 +36,13 @@ function resolveMainPath(main) {
32
+ @@ -24 ,6 +31,12 @@ function resolveMainPath(main) {
35
33
}
36
34
37
35
function shouldUseESMLoader(mainPath) {
@@ -41,7 +39,6 @@ index daaa153516c424334c18b5dfa35e0e55e1fbcce4..6181cc21bf303c41ed9c65681a34f639
41
39
+ if (typeof mainPath === 'string' && StringPrototypeStartsWith(mainPath, 'electron/js2c')) {
42
40
+ return false;
43
41
+ }
44
- +
45
42
/**
46
43
* @type {string[]} userLoaders A list of custom loaders registered by the user
47
44
* (or an empty list when none have been registered).