import { createApp } from 'vue'
import * as Sentry from '@sentry/browser'
import { Integrations } from '@sentry/tracing'
export default (app: ReturnType<typeof createApp>) => {
  Sentry.init({
    dsn: import.meta.env.SENTRY_DSN,
    integrations: [new Integrations.BrowserTracing()],
    tracesSampleRate: 1.0
  })
  app.config.errorHandler = err= > {
    Sentry.captureException(err)
  }
  window.addEventListener('error'.event= > {
    Sentry.captureException(event)
  })
  window.addEventListener('unhandledrejection'.event= > {
    Sentry.captureException(event)
  })
}

Copy the code