Skip to content

sentry is too havy for JS bundle (adds 500Kb prod) #3826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
6 of 11 tasks
vovkasm opened this issue May 18, 2024 · 2 comments
Closed
6 of 11 tasks

sentry is too havy for JS bundle (adds 500Kb prod) #3826

vovkasm opened this issue May 18, 2024 · 2 comments

Comments

@vovkasm
Copy link
Contributor

vovkasm commented May 18, 2024

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

SDK:

  • @sentry/react-native (>= 1.0.0)
  • react-native-sentry (<= 0.43.2)

SDK version: 5.22.2

react-native version: 0.73.8

Are you using Expo?

  • Yes
  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)
  • on-premise

Configuration:

(@sentry/react-native)

const routingInstrumentation = new Sentry.ReactNavigationInstrumentation({
  enableTimeToInitialDisplay: true,
});

    Sentry.init({
      dsn: Config.SENTRY_DSN,
      environment: Config.ENVIRONMENT,
      // enabled: !__DEV__,
      enableNative: true,
      tracesSampleRate: Config.ENVIRONMENT === "development" ? 1.0 : 0.01,
      integrations: [new Sentry.ReactNativeTracing({routingInstrumentation})],
    });

First of all, I want to thank the team for a wonderful product that greatly helps the entire community.

However, in recent years the product has become too heavy. Its total size in the production JS bundle is equal to the size of the entire RN, about to 500Kb. This can lead to slowdown at startup for highly optimized applications.

Steps to reproduce:

  • Create empty RN application
  • Just add @sentry/react-native to package.json and link it according to documentations
  • Build JS bundle, for ex: npx react-native bundle --entry-file index.js --platform android --dev false --bundle-output bundle0.dat --sourcemap-output bundle0.map
  • Show the results: npx source-map-explorer --no-border-checks bundle0.dat bundle0.map

Actual result:

In out real application it looks like this
sentry weight in real RN project

In clean RN project (as in repro)
sentry weight in clean RN project

Expected result:
I think it would be very good if the sentry weight was no more than 150Kb. I'm worried that people will stop using the sentry because it's so heavy, but it's a very good tool.

@vovkasm
Copy link
Contributor Author

vovkasm commented May 18, 2024

Potentially relative issues: #3718, #1818, #1733

@krystofwoldrich
Copy link
Member

Hi @vovkasm,
thank you for the kind words as well for expressing the worries.

Our browsers and core JS packages rely heavily on tree shaking which is not supported our of the box in React Native.

We realize that and are looking for other options to optimalize the size of the SDK.

I'll close this as a duplicate of #3718, we take this serious, I just want to keep all the discussion at one place. Please feel free to comment there as well as up vote the issue, that helps us prioritizing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Archived in project
Development

No branches or pull requests

2 participants