diff --git a/.changeset/weak-jars-tap.md b/.changeset/weak-jars-tap.md new file mode 100644 index 00000000000..5322d48f086 --- /dev/null +++ b/.changeset/weak-jars-tap.md @@ -0,0 +1,5 @@ +--- +'@module-federation/runtime': patch +--- + +fix: window.location.origin will be "null" in iframe srcDoc diff --git a/packages/runtime/src/core.ts b/packages/runtime/src/core.ts index e5ece7a9f92..27e340a1b4f 100644 --- a/packages/runtime/src/core.ts +++ b/packages/runtime/src/core.ts @@ -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; } }