Skip to content

Increase in possible unnecessary dependencies #5107

@dprevost-LMI

Description

@dprevost-LMI

What React Native libraries do you use?

React Native without Frameworks

Are you using sentry.io or on-premise?

sentry.io (SaS)

@sentry/react-native SDK Version

6.3.0

How does your development environment look like?

System:
  OS: macOS 15.6
  CPU: (12) arm64 Apple M2 Pro
  Memory: 826.63 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.19.4
    path: ~/.nvm/versions/node/v20.19.4/bin/node
  Yarn:
    version: 4.6.0
    path: ~/.nvm/versions/node/v20.19.4/bin/yarn
  npm:
    version: 10.8.2
    path: ~/.nvm/versions/node/v20.19.4/bin/npm
  Watchman:
    version: 2025.08.18.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/masked/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.1 AI-251.26094.121.2512.13930704
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.16
    path: /usr/bin/javac
  Ruby:
    version: 3.3.3
    path: /Users/masked/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react: Not Found
  react-native:
    installed: 0.77.2
    wanted: 0.77.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: true
  newArchEnabled: false

Sentry.init()

init({
  // Always keep Sentry enabled to execute reactNativeErrorHandlers integration and warn on unhandled promise rejections.
  // Setting sampleRate to 0 prevents sending them to Sentry server.
  enabled: true,
  dsn: isReleaseBuild()
    ? 'https://MASKED'
    : 'https://MASKED',
  environment: `${ENV}-${getBuildType()}-${Platform.OS}`,
  // Recommended release format https://docs.sentry.io/platforms/react-native/configuration/releases/#bind-the-version
  release: `${getBundleId()}@${getVersion()}+${getBuildNumber()}-${Platform.OS}`,
  dist: `${getBuildNumber()}`,
  sampleRate: sentrySample,
  defaultAndroidUserId: AppInfo.getUniqueId(),
  maxBreadcrumbs: 20,
  initialScope: {
    tags: { logUUID, buildType: getBuildType(), deviceId: AppInfo.getUniqueId() },
  },
  tracesSampleRate: sentryRateDisabled,
  tracePropagationTargets: [
    'MASKED',
  ],
  integrations: [
    navigationIntegration,
    reactNativeTracingIntegration({
      beforeStartSpan: (context) => ({
        ...context,
        name: `${Platform.OS} - ${context.name}`,
      }),
    }),
  ],
  patchGlobalPromise: false,
});

Steps to Reproduce

  1. Build an app with 5.33
  2. Use source-map-explorer to inspect the dependency
  3. Repeat for 6.3.0
  4. We observe an increase in the dependency and potential one named for Web

Expected Result

No dependencies on @sentry-internal/browser-utils

Actual Result

Increase in possible unnecessary dependencies

In react-native/sentry 5.33.0, we had the following dependencies pulled after integrating Sentry

    '@sentry',
    '@sentry-internal/tracing',
    '@sentry-internal/feedback/cjs',
    '@sentry-internal/replay-canvas/cjs',

Now, in 6.3.0, it has increased too:

    '@sentry',
    '@sentry-internal/browser-utils/build/cjs',
    '@sentry-internal/browser-utils/build/cjs/instrument',
    '@sentry-internal/browser-utils/build/cjs/metrics',
    '@sentry-internal/browser-utils/build/cjs/metrics/web-vitals',
    '@sentry-internal/browser-utils/build/cjs/metrics/web-vitals/lib',
    '@sentry-internal/browser-utils/build/cjs/metrics/web-vitals/lib/polyfills',
    '@sentry-internal/feedback/build/npm/cjs',
    '@sentry-internal/replay-canvas/build/npm/cjs',
    '@sentry-internal/replay/build/npm/cjs',

We are monitoring our dependencies, more importantly, on boot (which includes Sentry), as we have a critical business flow that requires answering incoming calls within a few milliseconds to seconds. Therefore, having unnecessary dependencies removed is quite essential.

Here, I suspect that browser-utils might be undesired since we are a react-native application and not a web one. Can someone explain why it is there and if it can be removed, if not already done? Thanks

Metadata

Metadata

Assignees

No fields configured for issues without a type.

Projects

Status

Waiting for: Community

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions