logdna / logdna-browser

A frontend browser logging and exception capturing library for LogDNA
MIT License
19 stars 14 forks source link

Cannot use in worker because window is not defined #64

Open bmatcuk opened 1 year ago

bmatcuk commented 1 year ago

In src/utils.ts, the console methods are cached. However, in a JS worker, window is undefined, and, so, this code fails with "ReferenceError: window is not defined".

It appears these cached methods are only used in two places: src/plugins/logger.ts and src/capture.ts.

bmatcuk commented 1 year ago

I opened a PR to fix the issue: https://github.com/logdna/logdna-browser/pull/65

asashay commented 1 year ago

That would be really nice to have! I am not able to use the library in the Web Extension's background script because of this

maxfliri commented 3 months ago

+1.

I have the same problem, and at the moment I'm unable to use this library in my client-side code. I'm using @logdna/logger instead, but that also has some problems because it's written for node and not for the browser.

When can we expect a fix for this?