From 543ef498a0a5213897a02b103436477b6024ec7b Mon Sep 17 00:00:00 2001 From: Bob Matcuk Date: Mon, 23 Jan 2023 15:53:05 -0500 Subject: [PATCH] fix(worker): fixed support with workers --- src/utils.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index 7b44551..ae76ee3 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -108,8 +108,10 @@ const originalConsole: any = consoleMethods.reduce( // This will delay the caching of the original instance of the console // until after logdna is enabled and initialized for use with SSR. const cacheConsole = () => { - const { log, error, debug, warn, info } = window.console; - cachedConsole = { log, error, debug, warn, info }; + if (window) { + const { log, error, debug, warn, info } = window.console; + cachedConsole = { log, error, debug, warn, info }; + } }; export default {