diff --git a/.changeset/chatty-cherries-train.md b/.changeset/chatty-cherries-train.md new file mode 100644 index 0000000000..18c275f073 --- /dev/null +++ b/.changeset/chatty-cherries-train.md @@ -0,0 +1,5 @@ +--- +'rrweb': patch +--- + +Fix the statement which is getting changed by Microbundle diff --git a/packages/rrweb/src/record/index.ts b/packages/rrweb/src/record/index.ts index 28271b9b5f..c69ee4b80d 100644 --- a/packages/rrweb/src/record/index.ts +++ b/packages/rrweb/src/record/index.ts @@ -94,8 +94,10 @@ function record( let passEmitsToParent = false; if (!inEmittingFrame) { try { - window.parent.document; // throws if parent is cross-origin - passEmitsToParent = false; // if parent is same origin we collect iframe events from the parent + // throws if parent is cross-origin + if (window.parent.document) { + passEmitsToParent = false; // if parent is same origin we collect iframe events from the parent + } } catch (e) { passEmitsToParent = true; }