Skip to content

Commit b129098

Browse files
authored
fix: window.location.origin will be 'null' in iframe srcDoc (#1956)
1 parent 1147f48 commit b129098

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/weak-jars-tap.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/runtime': patch
3+
---
4+
5+
fix: window.location.origin will be "null" in iframe srcDoc

packages/runtime/src/core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ export class FederationHost {
764764
}
765765
// Set the remote entry to a complete path
766766
if ('entry' in remote) {
767-
if (isBrowserEnv()) {
767+
if (isBrowserEnv() && !remote.entry.startsWith('http')) {
768768
remote.entry = new URL(remote.entry, window.location.origin).href;
769769
}
770770
}

0 commit comments

Comments
 (0)