diff --git a/src/utils.ts b/src/utils.ts index b209537..8254024 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -128,8 +128,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 {