diff --git a/packages/integrations/package.json b/packages/integrations/package.json index db4ff0cc64cb..6be25cf0accc 100644 --- a/packages/integrations/package.json +++ b/packages/integrations/package.json @@ -18,7 +18,7 @@ "dependencies": { "@sentry/types": "5.22.1", "@sentry/utils": "5.22.1", - "localforage": "^1.8.1", + "localforage": "1.8.1", "tslib": "^1.9.3" }, "devDependencies": { diff --git a/packages/integrations/src/offline.ts b/packages/integrations/src/offline.ts index dac92c0e5619..5d6d451c7eb1 100644 --- a/packages/integrations/src/offline.ts +++ b/packages/integrations/src/offline.ts @@ -1,7 +1,9 @@ import { Event, EventProcessor, Hub, Integration } from '@sentry/types'; import { getGlobalObject, logger, uuid4 } from '@sentry/utils'; -import * as localForage from 'localforage'; +import * as localForageType from 'localforage'; +// eslint-disable-next-line @typescript-eslint/no-var-requires +const localForage = require('localforage'); /** * cache offline errors and send when connected */ @@ -34,7 +36,7 @@ export class Offline implements Integration { /** * event cache */ - public offlineEventStore: LocalForage; // type imported from localforage + public offlineEventStore: typeof localForageType; // type imported from localforage /** * @inheritDoc @@ -42,6 +44,7 @@ export class Offline implements Integration { public constructor(options: { maxStoredEvents?: number } = {}) { this.global = getGlobalObject(); this.maxStoredEvents = options.maxStoredEvents || 30; // set a reasonable default + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access this.offlineEventStore = localForage.createInstance({ name: 'sentry/offlineEventStore', }); diff --git a/yarn.lock b/yarn.lock index 14a4c677edef..57598a0120c5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12386,10 +12386,10 @@ loader.js@^4.7.0: resolved "https://registry.yarnpkg.com/loader.js/-/loader.js-4.7.0.tgz#a1a52902001c83631efde9688b8ab3799325ef1f" integrity sha512-9M2KvGT6duzGMgkOcTkWb+PR/Q2Oe54df/tLgHGVmFpAmtqJ553xJh6N63iFYI2yjo2PeJXbS5skHi/QpJq4vA== -localforage@^1.8.1: - version "1.9.0" - resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.9.0.tgz#f3e4d32a8300b362b4634cc4e066d9d00d2f09d1" - integrity sha512-rR1oyNrKulpe+VM9cYmcFn6tsHuokyVHFaCM3+osEmxaHTbEk8oQu6eGDfS6DQLWi/N67XRmB8ECG37OES368g== +localforage@1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.8.1.tgz#f6c0a24b41ab33b10e4dc84342dd696f6f3e3433" + integrity sha512-azSSJJfc7h4bVpi0PGi+SmLQKJl2/8NErI+LhJsrORNikMZnhaQ7rv9fHj+ofwgSHrKRlsDCL/639a6nECIKuQ== dependencies: lie "3.1.1"