diff --git a/packages/rrweb/src/record/observer.ts b/packages/rrweb/src/record/observer.ts index 428cce1a4e..416b7c86c6 100644 --- a/packages/rrweb/src/record/observer.ts +++ b/packages/rrweb/src/record/observer.ts @@ -900,10 +900,12 @@ export function initAdoptedStyleSheetObserver( host.nodeName === '#document' ? (host as Document).defaultView?.Document : host.ownerDocument?.defaultView?.ShadowRoot; - const originalPropertyDescriptor = Object.getOwnPropertyDescriptor( - patchTarget?.prototype, - 'adoptedStyleSheets', - ); + const originalPropertyDescriptor = patchTarget?.prototype + ? Object.getOwnPropertyDescriptor( + patchTarget?.prototype, + 'adoptedStyleSheets', + ) + : undefined; if ( hostId === null || hostId === -1 ||