Skip to content

@sentry/vue Doesn't export all the @sentry/browser exports #3383

@Tofandel

Description

@Tofandel

The @sentry/vue package doesn't export all the @sentry/browser exports like @sentry/react does

Vue package

export {
  addGlobalEventProcessor,
  addBreadcrumb,
  captureException,
  captureEvent,
  captureMessage,
  configureScope,
  getHubFromCarrier,
  getCurrentHub,
  Hub,
  Scope,
  setContext,
  setExtra,
  setExtras,
  setTag,
  setTags,
  setUser,
  startTransaction,
  withScope,
} from '@sentry/browser';

React package

export * from '@sentry/browser';

As a result following the doc, the following will throw an error (because showReportDialog is not exported)

import Vue from "vue";
import * as Sentry from "@sentry/vue";


Sentry.init({
    Vue,
    environment: process.env.NODE_ENV,
    dsn: process.env.VUE_APP_SENTRY_DSN,
    beforeSend(event) {
      // Check if it is an exception, and if so, show the report dialog
      if (event.exception) {
        Sentry.showReportDialog({ eventId: event.event_id, user: event.user });
      }
      return event;
    },
  });

While it's possible to import it from the other package

import { showReportDialog } from "@sentry/browser";

It would be best to keep the packages coherent

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: vueIssues related to the Sentry Vue SDK

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions