Skip to content

Commit

Permalink
fix(nextjs): Export BrowserTracing integration directly (#4480)
Browse files Browse the repository at this point in the history
This applies the changes made in #4204 (exporting `BrowserTracing` outside of `Integrations`, in order that it be treeshakable if necessary) to the nextjs SDK, which got left out of that PR.

Fixes #4411.
  • Loading branch information
lobsterkatie authored Feb 1, 2022
1 parent 86fa701 commit 1214a03
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/nextjs/src/index.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@ export { nextRouterInstrumentation } from './performance/client';

export const Integrations = { ...BrowserIntegrations, BrowserTracing };

// This is already exported as part of `Integrations` above (and for the moment will remain so for
// backwards compatibility), but that interferes with treeshaking, so we also export it separately
// here.
//
// Previously we expected users to import `BrowserTracing` like this:
//
// import { Integrations } from '@sentry/nextjs';
// const instance = new Integrations.BrowserTracing();
//
// This makes the integrations unable to be treeshaken though. To address this, we now have
// this individual export. We now expect users to consume BrowserTracing like so:
//
// import { BrowserTracing } from '@sentry/nextjs';
// const instance = new BrowserTracing();
export { BrowserTracing };

/** Inits the Sentry NextJS SDK on the browser with the React SDK. */
export function init(options: NextjsOptions): void {
buildMetadata(options, ['nextjs', 'react']);
Expand Down

0 comments on commit 1214a03

Please sign in to comment.