Skip to content

Commit

Permalink
fix(runtime): adding reject to args in loadEsmEntry (module-federatio…
Browse files Browse the repository at this point in the history
…n#2067)

Co-authored-by: Zack Jackson <zackary.l.jackson@gmail.com>
  • Loading branch information
MadaraUchiha-314 and ScriptedAlchemy authored Mar 5, 2024
1 parent c15c3e7 commit 4fc20cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/late-wasps-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@module-federation/runtime': patch
---

adding reject to args in loadEsmEntry
6 changes: 3 additions & 3 deletions packages/runtime/src/utils/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export async function loadEsmEntry({
if (!remoteEntryExports) {
// eslint-disable-next-line no-eval
new Function(
'resolve',
`import("${entry}").then((res)=>{resolve(res);}, (error)=> reject(error))`,
)(resolve);
'callbacks',
`import("${entry}").then(callbacks[0]).catch(callbacks[1])`,
)([resolve, reject]);
} else {
resolve(remoteEntryExports);
}
Expand Down

0 comments on commit 4fc20cc

Please sign in to comment.