Repository navigation
build(core): Compile SDK to ES2018 to drop inlined TS helpers - #6957
Merged
Merged
Conversation
Raise the TypeScript compile target from es6 to es2018 so async/await and object rest are emitted natively instead of inlining `__awaiter`/`__rest` into every file of dist/js. `lib` stays at es7 to keep runtime API usage unchanged. Jest keeps compiling at es2016 to mirror Metro's Babel preset, which downlevels async functions onto the global (polyfilled) Promise. Closes #6955 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
Plus 4 more 🤖 This preview updates automatically when you update the PR. |
📲 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 f1bb829. Configure here.
antonis
marked this pull request as ready for review
October 28, 2026 10:28
alwx
approved these changes
Oct 29, 2026
Contributor
|
@antonis thank you! |
3 tasks done
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
Raises the TypeScript compile
targetof the SDK fromes6toes2018. TypeScript then emitsasync/awaitand object rest natively, instead of pasting a copy of the__awaiter/__resthelpers into each of the 31 affected files indist/js.tsconfig.build.jsonandtsconfig.build.tools.json:targetgoes fromes6toes2018.tsconfig.lint.json: same bump, to keep it in sync.tsconfig.json, which only Jest uses: pinned totarget: "es2016", with a comment (see below).libstays ates7on purpose. It limits which runtime APIs the code can use, and Metro converts syntax but doesn't add polyfills.We don't use the issue's other suggestion (
importHelpers+tslib).importHelperswas turned off on purpose in #4573, and it would add a runtime dependency.Why Jest stays at es2016:
Sentry.initreplaces the globalPromisewith React Native's polyfill (reactnativeerrorhandlersutils.ts).__awaiterand Babel's async-to-generator helper both build promises from that global. Nativeasyncalways uses the engine's built-in promises. In apps,@react-native/babel-presetstill convertsasyncto generators (unless theunstable_preserveAsyncexperiment is on), so the runtime behavior is unchanged. Keeping Jest at es2016 matches that. With es2018, 37 tests inreactnavigation.ttid.test.tsxandprofiling/integration.test.tsfail, because they rely on fake timers flushing the polyfilled promises.Compatibility: no new syntax requirement.
@sentry/core, which every app already bundles, ships ES2020 syntax (optional chaining, nativeasync). There's no API, type, or bridge change; the API report is unchanged.Caveat: app Jest suites that don't run Babel on
@sentry/react-nativewill now get nativeasyncfrom the SDK. Tests that relied on fake timers to flush SDK async work may need an extraawait. The commonly recommendedtransformIgnorePatternswhitelist includes@sentry/react-native, so most setups aren't affected.💡 Motivation and Context
Closes #6955: every app bundle carries ~31 duplicate copies of the TS helpers.
💚 How did you test it?
yarn build(deleteddist): no__awaiter/__restleft. The only remaining helpers are__createBinding/__exportStarfrom one CommonJSexport *in the Node-only tools output; they were already there and don't reach the app bundle.yarn test: 2236 SDK + 357 tools tests pass.yarn lint,yarn circularDepCheck,yarn api-report:check: pass (API report unchanged).samples/react-native(RN 0.88,--dev false --minify true), before vs after:__awaiteroccurrences in the bundle drop from 27 to 6 (the remaining 6 come from other packages). The number of nativeasyncfunctions in the bundle is unchanged, which confirms Metro still converts the SDK'sasynccode.ready-to-mergeCI.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
ready-to-mergelabel for the full sample/E2E CI (old/new architecture, Expo).🤖 Generated with Claude Code