From b247a70d89db7b37a09dd6f56b63f52db9a8d853 Mon Sep 17 00:00:00 2001 From: Katie Byers Date: Tue, 1 Feb 2022 09:47:40 -0800 Subject: [PATCH] export `BrowserTracing` integration directly --- packages/nextjs/src/index.client.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/nextjs/src/index.client.ts b/packages/nextjs/src/index.client.ts index 61a1b27da7f3..817f8ad3ca56 100644 --- a/packages/nextjs/src/index.client.ts +++ b/packages/nextjs/src/index.client.ts @@ -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']);