diff --git a/src/entrypoints/exception-autocapture.ts b/src/entrypoints/exception-autocapture.ts index 6bb2078d4..3cf09c41c 100644 --- a/src/entrypoints/exception-autocapture.ts +++ b/src/entrypoints/exception-autocapture.ts @@ -48,6 +48,9 @@ const posthogErrorWrappingFunctions = { wrapOnError, wrapUnhandledRejection, } -;(window as any).posthogErrorWrappingFunctions = posthogErrorWrappingFunctions + +if (window) { + ;(window as any).posthogErrorWrappingFunctions = posthogErrorWrappingFunctions +} export default posthogErrorWrappingFunctions