Skip to content
Permalink
Browse files

esm: fix esm load bug

Fixes: #25482

Backport-PR-URL: #27874
PR-URL: #25491
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information...
ZYSzys authored and BethGriggs committed May 13, 2019
1 parent 6e849c3 commit 819a647d8f91161698856578b70b320b0e0569e8
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/internal/modules/cjs/loader.js
@@ -661,9 +661,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,

0 comments on commit 819a647

Please sign in to comment.
You can’t perform that action at this time.