Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc54d829

Browse files
committed
lib: lazy-load deps in modules/run_main.js
nodejs/node#45849
1 parentb2644a7 commitc54d829

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

‎patches/node/fix_do_not_resolve_electron_entrypoints.patch

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,18 @@ Subject: fix: do not resolve electron entrypoints
66
This wastes fs cycles and can result in strange behavior if this path actually exists on disk
77

88
diff --git a/lib/internal/modules/run_main.js b/lib/internal/modules/run_main.js
9-
indexdaaa153516c424334c18b5dfa35e0e55e1fbcce4..6181cc21bf303c41ed9c65681a34f6393223fb67 100644
9+
index0bfe7b11241416bfca0d470047b14777ad99307f..c86add4395ed59cee0d880961e7572b0cc3d6698 100644
1010
--- a/lib/internal/modules/run_main.js
1111
+++ b/lib/internal/modules/run_main.js
12-
@@ -3,6 +3,7 @@
12+
@@ -2,12 +2,19 @@
13+
1314
const {
14-
ObjectCreate,
1515
StringPrototypeEndsWith,
1616
+ StringPrototypeStartsWith,
1717
} = 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');
2221

2322
function resolveMainPath(main) {
2423
+ // For built-in modules used as the main entry point we _never_
@@ -27,11 +26,10 @@ index daaa153516c424334c18b5dfa35e0e55e1fbcce4..6181cc21bf303c41ed9c65681a34f639
2726
+ if (typeof main === 'string' && StringPrototypeStartsWith(main, 'electron/js2c')) {
2827
+ return main;
2928
+ }
30-
+
3129
// Note extension resolution for the main entry point can be deprecated in a
3230
// future major.
3331
// Module._findPath is monkey-patchable here.
34-
@@ -28,6 +36,13 @@ function resolveMainPath(main) {
32+
@@ -24,6 +31,12 @@ function resolveMainPath(main) {
3533
}
3634

3735
function shouldUseESMLoader(mainPath) {
@@ -41,7 +39,6 @@ index daaa153516c424334c18b5dfa35e0e55e1fbcce4..6181cc21bf303c41ed9c65681a34f639
4139
+ if (typeof mainPath === 'string' && StringPrototypeStartsWith(mainPath, 'electron/js2c')) {
4240
+ return false;
4341
+ }
44-
+
4542
/**
4643
* @type {string[]} userLoaders A list of custom loaders registered by the user
4744
* (or an empty list when none have been registered).

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp