Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samoshkin/7dbe8c70717d9279bcc05cdb0e69edb8 to your computer and use it in GitHub Desktop.
Save samoshkin/7dbe8c70717d9279bcc05cdb0e69edb8 to your computer and use it in GitHub Desktop.
Conditionally build array using logical AND operator
const deployment = {
debug: process.env.NODE_ENV === 'development',
};
const defaultIntegrations = integrations.filter(x => x.name !== 'Dedupe');
return [
// add all the default integrations but those which were excluded using spread syntax
...defaultIntegrations,
// Extracts all non-native attributes from the Error object and attaches them to the event as the extra data
new ExtraErrorDataIntegration(),
// print event to DevTools console before sending it to Sentry
// enable this integration only in DEBUG mode
deployment.debug && new DebugIntegration(),
// send all console.log() messages to Sentry in DEBUG mode
deployment.debug && new CaptureConsoleIntegration(),
// in RELEASE mode
// Uses the web browser's online and offline events to detect when no network connectivity is available.
// If offline, it saves events to the web browser's client-side storage (typically IndexedDB),
// then automatically uploads events when network connectivity is restored.
// https://developer.mozilla.org/en-US/docs/Web/API/Navigator/Online_and_offline_events
!deployment.debug && new OfflineIntegration(),
].filter(Boolean);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment