From b43737804c503388740165c3ff650e4a97e24f57 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Fri, 16 Aug 2024 10:29:03 +0100 Subject: [PATCH] fix: only add to window when it exists --- src/entrypoints/exception-autocapture.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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