Skip to content

Commit 1214a03

Browse files
authored
fix(nextjs): Export BrowserTracing integration directly (#4480)
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.
1 parent 86fa701 commit 1214a03

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/nextjs/src/index.client.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ export { nextRouterInstrumentation } from './performance/client';
1111

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

14+
// This is already exported as part of `Integrations` above (and for the moment will remain so for
15+
// backwards compatibility), but that interferes with treeshaking, so we also export it separately
16+
// here.
17+
//
18+
// Previously we expected users to import `BrowserTracing` like this:
19+
//
20+
// import { Integrations } from '@sentry/nextjs';
21+
// const instance = new Integrations.BrowserTracing();
22+
//
23+
// This makes the integrations unable to be treeshaken though. To address this, we now have
24+
// this individual export. We now expect users to consume BrowserTracing like so:
25+
//
26+
// import { BrowserTracing } from '@sentry/nextjs';
27+
// const instance = new BrowserTracing();
28+
export { BrowserTracing };
29+
1430
/** Inits the Sentry NextJS SDK on the browser with the React SDK. */
1531
export function init(options: NextjsOptions): void {
1632
buildMetadata(options, ['nextjs', 'react']);

0 commit comments

Comments
 (0)