Skip to content

Commit

Permalink
fix(runtime): provide error message when remote entry init fails (#2746)
Browse files Browse the repository at this point in the history
Co-authored-by: ScriptedAlchemy <[email protected]>
  • Loading branch information
ScriptedAlchemy and ScriptedAlchemy authored Aug 14, 2024
1 parent 0aa2e68 commit 5c7ac8a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/tiny-pugs-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@module-federation/runtime': patch
---

provide error message when remote entry init fails
10 changes: 10 additions & 0 deletions packages/runtime/src/module/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ class Module {
origin: this.host,
});

if (typeof remoteEntryExports?.init === 'undefined') {
console.error(
'The remote entry interface does not contain "init"',
'\n',
'Ensure the name of this remote is not reserved or in use. Check if anything already exists on window[nameOfRemote]',
'\n',
'Ensure that window[nameOfRemote] is returning a {get,init} object.',
);
}

await remoteEntryExports.init(
initContainerOptions.shareScope,
initContainerOptions.initScope,
Expand Down

0 comments on commit 5c7ac8a

Please sign in to comment.