Skip to content

fix(core): Mark package as side-effect free - #6829

Open
devclaimjuimperai wants to merge 2 commits into
getsentry:mainfrom
devclaimjuimperai:fix/side-effects-false
Open

devclaimjuimperai wants to merge 2 commits into
getsentry:mainfrom
devclaimjuimperai:fix/side-effects-false

Conversation

@devclaimjuimperai

Copy link
Copy Markdown

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Adds "sideEffects": false to @sentry/react-native's package.json, same as @sentry/core, @sentry/react and @sentry/browser already have.

I grepped src/js for anything that runs at import time. The only top-level calls are in src/js/tools/ (metro config, babel transformer, collect-modules script), and those get loaded by Node directly, never bundled into the app. Nothing else patches globals on import.

💡 Motivation and Context

Fixes getsentry/sentry#126410. Without the flag, importing even just SDK_VERSION drags most of the SDK into the bundle with esbuild/Rollup/webpack (and Expo's tree shaking).

💚 How did you test it?

Ran the repro from the issue against the published 8.29.0, with and without the flag patched into its package.json (I also had to mark promise/* as external):

input files output bytes
before 121 87303
after 3 972

📝 Checklist

  • I added tests to verify changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.
  • No breaking changes.

🔮 Next steps

@devclaimjuimperai
devclaimjuimperai deleted the fix/side-effects-false branch October 3, 2026 22:41
@devclaimjuimperai
devclaimjuimperai restored the fix/side-effects-false branch October 3, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@sentry/react-native is not tree-shakeable: missing "sideEffects": false in package.json

1 participant