fix: convert bugsnag to static import

This commit is contained in:
Baptiste Grob
2020-11-03 19:12:15 +01:00
parent 6cd4b8707a
commit 63233fcd52
2 changed files with 4 additions and 3 deletions

View File

@@ -1,16 +1,16 @@
import { SNLog } from 'snjs';
import { isDesktopApplication, isDev } from '@/utils';
import { storage, StorageKey } from './localStorage';
import Bugsnag from '@bugsnag/js';
declare const __VERSION__: string;
export async function startErrorReporting() {
export function startErrorReporting() {
if (storage.get(StorageKey.DisableErrorReporting)) {
SNLog.onError = console.error;
return;
}
try {
const { default: Bugsnag } = await import('@bugsnag/js');
Bugsnag.start({
apiKey: (window as any)._bugsnag_api_key,
appType: isDesktopApplication() ? 'desktop' : 'web',
@@ -28,5 +28,6 @@ export async function startErrorReporting() {
}
} catch (error) {
console.error('Failed to start Bugsnag.', error);
SNLog.onError = console.error;
}
}