-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Package: nextjsIssues related to the Sentry Nextjs SDKIssues related to the Sentry Nextjs SDKType: Improvement
Milestone
Description
Problem Statement
Following the sentry/nextjs recommended approach, it's difficult to opt-out from tracing in the browser.
The sentry/tracing adds more or less 30kb to the browser final bundle which is a hard blocker in some circumstances.
Here's a tree map taken with the recommended approach and tested with @sentry/nextjs 6.18.2
Solution Brainstorm
I was able to remove the sentry/tracing from the browser, by importing sentry/react rather than sentry/nextjs
// import { init as sentryInit } from '@sentry/nextjs';
import { init as sentryInit } from '@sentry/react';
sentryInit({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
// tracesSampleRate: 1.0,
});That reduced the bundle from 103kb to 73kb
The setup is belgattitude/nextjs-monorepo-example#1409
Is there any drawbacks or risks to this approach (apart from not sending traces) ?
meotimdihia
Metadata
Metadata
Assignees
Labels
Package: nextjsIssues related to the Sentry Nextjs SDKIssues related to the Sentry Nextjs SDKType: Improvement

