Conversation
…rts under strict package managers The published package imports several modules it never declares, relying on flat node_modules hoisting to resolve them. Under isolated/strict stores (pnpm's default isolated linker, Yarn PnP, Bun) these fail to resolve. Declare them as optional peer dependencies so they resolve when present, without forcing installation on apps that don't use the related integration or build tooling. - Runtime guarded requires: @expo/config, @expo/env, dotenv, expo-router, expo-updates, open, promise, @react-navigation/native - Type-only .d.ts references: metro, metro-resolver, @babel/core, @expo/config-types Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
antonis
force-pushed
the
fix/declare-optional-peer-deps
branch
from
September 16, 2026 12:16
a4524ad to
42b5de1
Compare
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
Declaring the optional peers moved several packages out of the workspace's
own node_modules (a peer is expected to be provided by the consumer), which
broke the SDK's own build, type-aware lint, and tests:
- Type-only imports lost their types: metro-resolver (metroconfig.ts),
@expo/config-types (plugin/withSentry.ts) -> oxlint type-aware errors.
- jest.mock('@expo/config') could no longer resolve -> tools test suites
failed to load.
- promise/setimmediate stopped resolving -> setImmediate-based transport
flush broke, so tracing/profiling suites captured no transaction.
Add these back as devDependencies (matching the existing metro/@babel/core
pattern) so the workspace builds and tests itself, while keeping them as
optional peers for consumers. Also declare metro-config as an optional peer
(metroMiddleware.ts imports its types, re-exported via metro.d.ts).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Android (legacy) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| a2585ce+dirty | 426.36 ms | 483.26 ms | 56.90 ms |
| 882f8ae+dirty | 399.98 ms | 427.06 ms | 27.08 ms |
| af33f3b+dirty | 434.90 ms | 506.14 ms | 71.24 ms |
| ecf47a2+dirty | 420.40 ms | 458.02 ms | 37.62 ms |
| acd838e+dirty | 422.63 ms | 462.39 ms | 39.76 ms |
| 7fd0012+dirty | 444.73 ms | 470.08 ms | 25.35 ms |
| 580fb5c+dirty | 436.34 ms | 471.63 ms | 35.28 ms |
| 5ca03f9+dirty | 423.30 ms | 467.00 ms | 43.70 ms |
| 5c1e987+dirty | 423.52 ms | 471.64 ms | 48.12 ms |
| 822d35b+dirty | 429.31 ms | 498.04 ms | 68.73 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| a2585ce+dirty | 49.74 MiB | 55.36 MiB | 5.61 MiB |
| 882f8ae+dirty | 48.30 MiB | 53.60 MiB | 5.29 MiB |
| af33f3b+dirty | 49.74 MiB | 55.09 MiB | 5.35 MiB |
| ecf47a2+dirty | 49.74 MiB | 54.82 MiB | 5.07 MiB |
| acd838e+dirty | 48.30 MiB | 53.60 MiB | 5.30 MiB |
| 7fd0012+dirty | 50.56 MiB | 56.46 MiB | 5.90 MiB |
| 580fb5c+dirty | 49.74 MiB | 54.79 MiB | 5.05 MiB |
| 5ca03f9+dirty | 49.74 MiB | 55.26 MiB | 5.52 MiB |
| 5c1e987+dirty | 43.75 MiB | 48.08 MiB | 4.33 MiB |
| 822d35b+dirty | 49.74 MiB | 54.84 MiB | 5.10 MiB |
Contributor
iOS (legacy) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0a9e622+dirty | 3835.87 ms | 1221.07 ms | -2614.80 ms |
| 7d6fd3a+dirty | 1223.29 ms | 1229.57 ms | 6.28 ms |
| 5ca03f9+dirty | 3844.55 ms | 1218.36 ms | -2626.19 ms |
| 774257e+dirty | 3846.90 ms | 1215.02 ms | -2631.88 ms |
| 40c9884+dirty | 3837.72 ms | 1226.61 ms | -2611.11 ms |
| 4e0b819+dirty | 3839.05 ms | 1210.75 ms | -2628.30 ms |
| d038a14+dirty | 3845.71 ms | 1228.11 ms | -2617.59 ms |
| 57e0069+dirty | 3842.29 ms | 1212.12 ms | -2630.17 ms |
| 882f8ae+dirty | 3840.30 ms | 1224.41 ms | -2615.88 ms |
| 5125c43+dirty | 3846.45 ms | 1221.12 ms | -2625.32 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0a9e622+dirty | 4.98 MiB | 6.51 MiB | 1.53 MiB |
| 7d6fd3a+dirty | 3.38 MiB | 4.77 MiB | 1.39 MiB |
| 5ca03f9+dirty | 4.98 MiB | 6.53 MiB | 1.55 MiB |
| 774257e+dirty | 5.15 MiB | 6.70 MiB | 1.54 MiB |
| 40c9884+dirty | 4.98 MiB | 6.51 MiB | 1.53 MiB |
| 4e0b819+dirty | 4.98 MiB | 6.46 MiB | 1.49 MiB |
| d038a14+dirty | 5.15 MiB | 6.67 MiB | 1.51 MiB |
| 57e0069+dirty | 4.98 MiB | 6.50 MiB | 1.52 MiB |
| 882f8ae+dirty | 5.15 MiB | 6.70 MiB | 1.54 MiB |
| 5125c43+dirty | 5.15 MiB | 6.68 MiB | 1.53 MiB |
📲 Install BuildsAndroid
|
There was a problem hiding this comment.
✅ 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 8abd69b. Configure here.
Contributor
iOS (new) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 68ae91b+dirty | 3836.36 ms | 1222.04 ms | -2614.32 ms |
| 0b5a379+dirty | 3857.69 ms | 1230.34 ms | -2627.35 ms |
| bf168a4+dirty | 3846.83 ms | 1221.33 ms | -2625.49 ms |
| f170ec3+dirty | 3844.74 ms | 1222.67 ms | -2622.07 ms |
| 68672fc+dirty | 3832.22 ms | 1228.29 ms | -2603.93 ms |
| 84cba31+dirty | 3830.40 ms | 1204.44 ms | -2625.96 ms |
| 2c735cc+dirty | 1223.33 ms | 1224.38 ms | 1.04 ms |
| b9bebee+dirty | 3858.02 ms | 1231.92 ms | -2626.11 ms |
| a50b33d+dirty | 1207.11 ms | 1212.10 ms | 5.00 ms |
| 5569641+dirty | 3824.35 ms | 1210.78 ms | -2613.57 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 68ae91b+dirty | 4.98 MiB | 6.46 MiB | 1.48 MiB |
| 0b5a379+dirty | 5.15 MiB | 6.70 MiB | 1.54 MiB |
| bf168a4+dirty | 4.98 MiB | 6.47 MiB | 1.49 MiB |
| f170ec3+dirty | 5.15 MiB | 6.69 MiB | 1.53 MiB |
| 68672fc+dirty | 5.15 MiB | 6.71 MiB | 1.55 MiB |
| 84cba31+dirty | 4.98 MiB | 6.55 MiB | 1.57 MiB |
| 2c735cc+dirty | 3.38 MiB | 4.74 MiB | 1.35 MiB |
| b9bebee+dirty | 5.15 MiB | 6.68 MiB | 1.53 MiB |
| a50b33d+dirty | 3.38 MiB | 4.73 MiB | 1.35 MiB |
| 5569641+dirty | 5.15 MiB | 6.67 MiB | 1.51 MiB |
Contributor
Android (new) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| f3215d3+dirty | 396.53 ms | 436.66 ms | 40.13 ms |
| d0e3b3e+dirty | 443.19 ms | 480.00 ms | 36.81 ms |
| a5d243c+dirty | 499.20 ms | 525.62 ms | 26.42 ms |
| 7fd0012+dirty | 422.41 ms | 445.57 ms | 23.17 ms |
| 0a147b2+dirty | 442.80 ms | 522.24 ms | 79.44 ms |
| d7d54c6+dirty | 423.54 ms | 498.56 ms | 75.02 ms |
| c823bb5+dirty | 468.26 ms | 516.16 ms | 47.90 ms |
| 5789645+dirty | 502.66 ms | 594.19 ms | 91.53 ms |
| 40c9884+dirty | 453.76 ms | 478.98 ms | 25.22 ms |
| d771cd5+dirty | 432.29 ms | 464.38 ms | 32.09 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| f3215d3+dirty | 48.30 MiB | 53.49 MiB | 5.19 MiB |
| d0e3b3e+dirty | 49.74 MiB | 55.09 MiB | 5.34 MiB |
| a5d243c+dirty | 48.30 MiB | 53.54 MiB | 5.23 MiB |
| 7fd0012+dirty | 50.56 MiB | 56.46 MiB | 5.90 MiB |
| 0a147b2+dirty | 49.74 MiB | 55.08 MiB | 5.34 MiB |
| d7d54c6+dirty | 49.74 MiB | 55.09 MiB | 5.34 MiB |
| c823bb5+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
| 5789645+dirty | 49.74 MiB | 54.85 MiB | 5.11 MiB |
| 40c9884+dirty | 49.74 MiB | 55.09 MiB | 5.34 MiB |
| d771cd5+dirty | 49.74 MiB | 55.36 MiB | 5.62 MiB |
antonis
marked this pull request as ready for review
September 16, 2026 13:09
antonis
commented
Sep 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📢 Type of change
📜 Description
The published
@sentry/react-nativepackage imports several modules it never declares inpackage.json, relying on flatnode_moduleshoisting to resolve them. Under isolated/strict stores — pnpm's defaultisolatedlinker, Yarn PnP, and Bun — these imports can fail to resolve (MODULE_NOT_FOUND/ unresolved type declarations) because a package may only reach dependencies it explicitly declares.This declares each of them as an optional peer dependency, so they resolve when present without forcing installation on apps that don't use the related integration or build tooling (
peerDependenciesMeta.optionalalso prevents auto-install by npm 7+/pnpm and suppresses missing-peer warnings).Two categories, all verified against real import/require sites:
require()@expo/config,@expo/env,dotenv,expo-router,expo-updates,open,promise,@react-navigation/nativesrc/js/tools/utils.ts(require('@expo/config')),integrations/expoupdateslistener.ts(require('expo-updates')).d.tsmetro,metro-resolver,@babel/core,@expo/config-typesdist/js/tools/*.d.ts(import type … from 'metro')Ranges are
*for the optional integration packages (matching the sibling@sentry/expo-upload-sourcemaps, which already declares@expo/env/dotenvthis way, and the SDK's own supportedreact-nativefloor which ships older Metro);@babel/coreuses>=7.0.0.No runtime behavior change: every affected
requireis already wrapped in try/catch or gated behind an integration the user opted into, and the type-only imports are erased at build time.💡 Motivation and Context
https://nubjs.com/blog/phantom-dependencies-package-extensions
💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
🤖 Generated with Claude Code