Closed as not planned
Description
When importing @sentry/browser
from a service worker file (e.g: background.js) like
import * as Sentry from '@sentry/browser';
we get
Uncaught TypeError: Cannot read properties of undefined (reading 'visibilityState')
var initHiddenTime = () => {
return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__.getGlobalObject)().document.visibilityState === 'hidden' ? 0 : Infinity;
};
It crashes at the import level, because @sentry/browser relies on the document
which doesn't exist in the context of a background script.
Edit: That's because I was loading BrowserTracing
, when removing it it doesn't crash!
Originally posted by @Vadorequest in #4098 (comment)
Metadata
Metadata
Assignees
Type
Projects
Status
No status
Status
No status
Status
Waiting for: Community