Skip to content

fix(core): Exclude additional server-only modules from native bundles - #6263

Merged
antonis merged 5 commits into
mainfrom
fix/exclude-server-only-modules-from-native-bundle
Jun 9, 2026
Merged

fix(core): Exclude additional server-only modules from native bundles#6263
antonis merged 5 commits into
mainfrom
fix/exclude-server-only-modules-from-native-bundle

Conversation

@antonis

@antonisantonis commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Expands the Metro resolver's SERVER_ONLY_MODULE_RE regex to exclude additional server-only modules from Android/iOS bundles:

  • integrations/express
  • integrations/postgresjs
  • integrations/requestdata
  • integrations/consola
  • integrations/spanStreaming

Also fixes the regex terminator from (\/|$) to (\/|\.js|$) so it correctly matches single-file modules like postgresjs.js (not just directory-style paths like mcp-server/).

💡 Motivation and Context

Related: #6262

💚 How did you test it?

  • Added test cases for all 5 new modules (20 new tests) — all pass
  • Verified via source map analysis that all listed modules are excluded from the Android bundle
  • Confirmed bundle size reduction from 5.09 MB → 4.31 MB in the sample app

📝 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
  • No breaking changes

🔮 Next steps

Expand the Metro resolver's server-only module exclusion regex to cover
express, postgresjs, requestdata, consola, and spanStreaming integrations.
Also fix the regex terminator to match single-file modules (`.js` suffix).
Closes#6262
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions

github-actionsBot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • fix(core): Exclude additional server-only modules from native bundles by antonis in #6263
  • Turbo Modules crash time context by alwx in #6227
  • fix: resolve sentry-cli relative to react-native package by shawnthye-guru in #6242
  • chore(deps): bump getsentry/craft from 2.26.6 to 2.26.8 by dependabot in #6260
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.26.6 to 2.26.8 by dependabot in #6259
  • chore(deps): bump actions/checkout from 6.0.2 to 6.0.3 by dependabot in #6257
  • chore(deps): bump github/codeql-action from 4.36.0 to 4.36.2 by dependabot in #6258
  • chore(deps): update Cocoa SDK to v9.16.1 by github-actions in #6252
  • chore(deps): update Android SDK to v8.43.1 by github-actions in #6253
  • chore(deps): update Sentry Android Gradle Plugin to v6.10.0 by github-actions in #6255
  • feat(tracing): Wrap Expo Router push, replace, navigate, back, dismiss in addition to prefetch by alwx in #6221
  • chore(deps): bump jwt in /samples/react-native by antonis in #6251
  • feat(profiling): Add measurements to Android profiling by antonis in #6250
  • chore(deps): update CLI to v3.5.0 by github-actions in #6248
  • chore(deps): bump jwt from 2.9.3 to 2.10.3 in /samples/react-native-macos by dependabot in #6247
  • chore(deps): bump jwt from 2.10.2 to 2.10.3 in /performance-tests by dependabot in #6246
  • feat(android): Warn when Gradle resolves unsupported sentry-android version by antonis in #6238
  • chore(deps): update JavaScript SDK to v10.56.0 by github-actions in #6249
  • chore(ci): Pin all GitHub Actions to full commit SHAs by antonis in #6243
  • fix(tracing): Enable fetch instrumentation when expo/fetch is active by antonis in #6226
  • fix: Bump tmp to 0.2.7 to resolve path traversal vulnerability by antonis in #6233
  • feat(logs): Add enableAutoConsoleLogs option to opt out of console capture by alwx in #6235
  • chore(deps): update JavaScript SDK to v10.55.0 by github-actions in #6222
  • chore(deps): update Sentry Android Gradle Plugin to v6.9.0 by github-actions in #6230

Plus 1 more


🤖 This preview updates automatically when you update the PR.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 0f8183c. Configure here.

@antonisantonis added the ready-to-merge Triggers the full CI test suite label Jun 8, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Android (legacy) Performance metrics 🚀

PlainWith SentryDiff
Startup time571.60 ms581.50 ms9.90 ms
Size48.30 MiB53.56 MiB5.25 MiB

Baseline results on branch: main

Startup times

RevisionPlainWith SentryDiff
5569641+dirty406.43 ms428.51 ms22.08 ms
ae37560+dirty470.40 ms564.12 ms93.72 ms
2c735cc+dirty414.09 ms438.47 ms24.38 ms
d2eadf8+dirty414.64 ms454.56 ms39.92 ms
7ff4d0f+dirty413.81 ms450.64 ms36.83 ms
a0d8cf8+dirty411.71 ms467.57 ms55.87 ms
71abba0+dirty496.54 ms525.16 ms28.63 ms
038a6d7+dirty524.82 ms531.92 ms7.10 ms
0b5120f+dirty503.22 ms538.60 ms35.38 ms
7d6fd3a+dirty403.02 ms422.56 ms19.54 ms

App size

RevisionPlainWith SentryDiff
5569641+dirty48.30 MiB53.48 MiB5.18 MiB
ae37560+dirty48.30 MiB53.60 MiB5.29 MiB
2c735cc+dirty43.75 MiB48.08 MiB4.33 MiB
d2eadf8+dirty48.30 MiB53.48 MiB5.18 MiB
7ff4d0f+dirty48.30 MiB53.60 MiB5.30 MiB
a0d8cf8+dirty48.30 MiB53.49 MiB5.19 MiB
71abba0+dirty48.30 MiB53.49 MiB5.19 MiB
038a6d7+dirty48.30 MiB53.60 MiB5.30 MiB
0b5120f+dirty48.30 MiB53.58 MiB5.28 MiB
7d6fd3a+dirty43.75 MiB48.14 MiB4.39 MiB

@sentry

sentryBot commented Jun 8, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App NameApp IDVersionConfiguration
Sentry RNio.sentry.reactnative.sample8.13.0 (90)Release

⚙️ sentry-react-native Build Distribution Settings

@github-actions

Copy link
Copy Markdown
Contributor

iOS (legacy) Performance metrics 🚀

PlainWith SentryDiff
Startup time3859.40 ms1209.26 ms-2650.14 ms
Size5.15 MiB6.68 MiB1.53 MiB

Baseline results on branch: main

Startup times

RevisionPlainWith SentryDiff
5c1e987+dirty1204.30 ms1222.15 ms17.85 ms
3817909+dirty1183.90 ms1187.50 ms3.60 ms
7d6fd3a+dirty1223.29 ms1229.57 ms6.28 ms
5569641+dirty3839.22 ms1231.30 ms-2607.91 ms
0b5120f+dirty3838.39 ms1232.91 ms-2605.48 ms
7ac3378+dirty1213.37 ms1218.15 ms4.78 ms
4b87b12+dirty1212.90 ms1222.09 ms9.19 ms
890d145+dirty1223.59 ms1231.37 ms7.78 ms
ef27341+dirty3856.13 ms1231.42 ms-2624.71 ms
ad66da3+dirty3820.96 ms1214.43 ms-2606.52 ms

App size

RevisionPlainWith SentryDiff
5c1e987+dirty3.38 MiB4.73 MiB1.35 MiB
3817909+dirty3.38 MiB4.73 MiB1.35 MiB
7d6fd3a+dirty3.38 MiB4.77 MiB1.39 MiB
5569641+dirty5.15 MiB6.67 MiB1.51 MiB
0b5120f+dirty5.15 MiB6.68 MiB1.53 MiB
7ac3378+dirty3.38 MiB4.76 MiB1.38 MiB
4b87b12+dirty3.38 MiB4.77 MiB1.39 MiB
890d145+dirty3.38 MiB4.77 MiB1.38 MiB
ef27341+dirty5.15 MiB6.68 MiB1.53 MiB
ad66da3+dirty5.15 MiB6.67 MiB1.51 MiB

@github-actions

Copy link
Copy Markdown
Contributor

iOS (new) Performance metrics 🚀

PlainWith SentryDiff
Startup time3840.76 ms1214.71 ms-2626.05 ms
Size5.15 MiB6.68 MiB1.53 MiB

Baseline results on branch: main

Startup times

RevisionPlainWith SentryDiff
5c1e987+dirty1208.43 ms1220.72 ms12.29 ms
3817909+dirty1210.76 ms1215.64 ms4.89 ms
7d6fd3a+dirty1210.89 ms1217.63 ms6.74 ms
5569641+dirty3824.35 ms1210.78 ms-2613.57 ms
0b5120f+dirty3843.24 ms1223.00 ms-2620.24 ms
7ac3378+dirty1202.35 ms1198.31 ms-4.04 ms
4b87b12+dirty1199.49 ms1199.78 ms0.29 ms
890d145+dirty1212.98 ms1220.10 ms7.12 ms
ef27341+dirty3835.20 ms1212.23 ms-2622.97 ms
ad66da3+dirty3855.02 ms1213.43 ms-2641.59 ms

App size

RevisionPlainWith SentryDiff
5c1e987+dirty3.38 MiB4.73 MiB1.35 MiB
3817909+dirty3.38 MiB4.73 MiB1.35 MiB
7d6fd3a+dirty3.38 MiB4.77 MiB1.39 MiB
5569641+dirty5.15 MiB6.67 MiB1.51 MiB
0b5120f+dirty5.15 MiB6.68 MiB1.53 MiB
7ac3378+dirty3.38 MiB4.76 MiB1.38 MiB
4b87b12+dirty3.38 MiB4.77 MiB1.39 MiB
890d145+dirty3.38 MiB4.77 MiB1.38 MiB
ef27341+dirty5.15 MiB6.68 MiB1.53 MiB
ad66da3+dirty5.15 MiB6.67 MiB1.51 MiB

@github-actions

Copy link
Copy Markdown
Contributor

Android (new) Performance metrics 🚀

PlainWith SentryDiff
Startup time433.90 ms452.60 ms18.70 ms
Size48.30 MiB53.56 MiB5.25 MiB

Baseline results on branch: main

Startup times

RevisionPlainWith SentryDiff
8929511+dirty469.49 ms502.65 ms33.16 ms
a736b76+dirty405.78 ms458.74 ms52.96 ms
5c1e987+dirty444.71 ms475.13 ms30.42 ms
5569641+dirty465.92 ms532.22 ms66.30 ms
ae37560+dirty428.96 ms456.86 ms27.90 ms
d2eadf8+dirty468.02 ms530.37 ms62.35 ms
7ff4d0f+dirty403.38 ms427.06 ms23.68 ms
a0d8cf8+dirty533.71 ms564.25 ms30.54 ms
71abba0+dirty411.04 ms453.67 ms42.63 ms
038a6d7+dirty499.02 ms527.68 ms28.66 ms

App size

RevisionPlainWith SentryDiff
8929511+dirty43.94 MiB49.02 MiB5.08 MiB
a736b76+dirty48.30 MiB53.48 MiB5.18 MiB
5c1e987+dirty43.94 MiB48.94 MiB5.00 MiB
5569641+dirty48.30 MiB53.48 MiB5.18 MiB
ae37560+dirty48.30 MiB53.60 MiB5.29 MiB
d2eadf8+dirty48.30 MiB53.48 MiB5.18 MiB
7ff4d0f+dirty48.30 MiB53.60 MiB5.30 MiB
a0d8cf8+dirty48.30 MiB53.49 MiB5.19 MiB
71abba0+dirty48.30 MiB53.49 MiB5.19 MiB
038a6d7+dirty48.30 MiB53.60 MiB5.30 MiB

@antonis
antonis marked this pull request as ready for review June 8, 2026 11:36
@antonisantonis removed the ready-to-merge Triggers the full CI test suite label Jun 9, 2026
@github-actions

github-actionsBot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor
Fails
🚫Pull request is not ready for merge, please add the "ready-to-merge" label to the pull request

Generated by 🚫 dangerJS against 788a0c6

Comment threadCHANGELOG.md
- Exclude additional server-only modules (`express`, `postgresjs`, `requestdata`, `consola`, `spanStreaming`) from native bundles ([#6263](https://github.com/getsentry/sentry-react-native/pull/6263))
- Enable fetch instrumentation when Expo SDK 56's native `expo/fetch` is active ([#6226](https://github.com/getsentry/sentry-react-native/pull/6226))

### Fixes

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the duplicate section from previous merge

@lucas-zimermanlucas-zimerman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT!

@antonis
antonis merged commit f170ec3 into mainJun 9, 2026
59 of 65 checks passed
@antonis
antonis deleted the fix/exclude-server-only-modules-from-native-bundle branch June 9, 2026 12:59
Sign up for freeto 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.

2 participants

@antonis@lucas-zimerman