bootstrap: initialize http proxy after user module loader setup

The externalized undici relies on the user module loader, so
in the externalized build, initialization of http proxy which
relies on undici needs to be deferred until after the user module
loader is initialized.

PR-URL: https://github.com/nodejs/node/pull/58938
Refs: https://github.com/nodejs/node/issues/58865
Refs: https://github.com/nodejs/node/issues/57872
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Joyee Cheung
2025-07-05 03:10:38 +02:00
committed by GitHub
parent 19876f492e
commit 053467253d

View File

@@ -126,7 +126,6 @@ function prepareExecution(options) {
initializeConfigFileSupport();
require('internal/dns/utils').initializeDns();
setupHttpProxy();
if (isMainThread) {
assert(internalBinding('worker').isMainThread);
@@ -159,6 +158,10 @@ function prepareExecution(options) {
setupUserModules(forceDefaultLoader);
}
// This has to be done after the user module loader is initialized,
// in case undici is externalized.
setupHttpProxy();
return mainEntry;
}