| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Sorry, something went wrong.
|
Would it maybe make more sense to provide callbackMap unconditionally? e.g. this (untested): diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js
index a51dbf05ec4f..8d4c44922ac0 100644
--- a/lib/internal/bootstrap/pre_execution.js
+++ b/lib/internal/bootstrap/pre_execution.js
@@ -60,9 +60,7 @@ function prepareMainThreadExecution(expandArgv1 = false) {
initializeWASI();
initializeCJSLoader();
- if (!shouldNotRegisterESMLoader) {
- initializeESMLoader();
- }
+ initializeESMLoader();
const CJSLoader = require('internal/modules/cjs/loader');
assert(!CJSLoader.hasLoadedAnyUserCJSModule);
@@ -406,6 +404,8 @@ function initializeESMLoader() {
// Create this WeakMap in js-land because V8 has no C++ API for WeakMap.
internalBinding('module_wrap').callbackMap = new SafeWeakMap();
+ if (!shouldNotRegisterESMLoader) return;
+
const {
setImportModuleDynamicallyCallback,
setInitializeImportMetaObjectCallbackThat requires a smaller patch and would also make things easier in case we do figure out a good way to mix ESM loaders (e.g. by making them per-Context)? |
Sorry, something went wrong.
|
That also works! Will do :) |
Sorry, something went wrong.
Sorry, something went wrong.
PR-URL: #34127 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host>
PR-URL: #34127 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host>
PR-URL: #34127 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host>
PR-URL: #34127 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host>
| Back | FazBrowse Home | New Git URL |
Refs #34060.
We should instead unilaterally initialize the callbackMap and return early if an embedder is choosing to not use the Node.js esm loader is in an embedder context.
I also updated the corresponding tests to more directly check importModuleDynamically functionality affected by a decision to not use the esm loader provided by Node.js.
cc @addaleax @joyeecheung
Checklist