Skip to content

Commit

Permalink
fix: window.location.origin will be 'null' in iframe srcDoc (#1956)
Browse files Browse the repository at this point in the history
  • Loading branch information
2heal1 authored Jan 15, 2024
1 parent 1147f48 commit b129098
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/weak-jars-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@module-federation/runtime': patch
---

fix: window.location.origin will be "null" in iframe srcDoc
2 changes: 1 addition & 1 deletion packages/runtime/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ export class FederationHost {
}
// Set the remote entry to a complete path
if ('entry' in remote) {
if (isBrowserEnv()) {
if (isBrowserEnv() && !remote.entry.startsWith('http')) {
remote.entry = new URL(remote.entry, window.location.origin).href;
}
}
Expand Down

0 comments on commit b129098

Please sign in to comment.