esm: fix esm load bug
Fixes: https://github.com/nodejs/node/issues/25482 PR-URL: https://github.com/nodejs/node/pull/25491 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
523a9fbcb4
commit
6fe369286a
@ -648,9 +648,11 @@ Module.prototype.load = function(filename) {
|
||||
// Create module entry at load time to snapshot exports correctly
|
||||
const exports = this.exports;
|
||||
if (module !== undefined) { // Called from cjs translator
|
||||
module.reflect.onReady((reflect) => {
|
||||
reflect.exports.default.set(exports);
|
||||
});
|
||||
if (module.reflect) {
|
||||
module.reflect.onReady((reflect) => {
|
||||
reflect.exports.default.set(exports);
|
||||
});
|
||||
}
|
||||
} else { // preemptively cache
|
||||
ESMLoader.moduleMap.set(
|
||||
url,
|
||||
|
Loading…
x
Reference in New Issue
Block a user