Skip to content

build(core): Compile SDK to ES2018 to drop inlined TS helpers - #6957

Merged
antonis merged 3 commits into
mainfrom
build/es2018-target
Oct 29, 2026
Merged

antonis merged 3 commits into
mainfrom
build/es2018-target

Conversation

@antonis

@antonis antonis commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Raises the TypeScript compile target of the SDK from es6 to es2018. TypeScript then emits async/await and object rest natively, instead of pasting a copy of the __awaiter/__rest helpers into each of the 31 affected files in dist/js.

  • tsconfig.build.json and tsconfig.build.tools.json: target goes from es6 to es2018.
  • tsconfig.lint.json: same bump, to keep it in sync.
  • tsconfig.json, which only Jest uses: pinned to target: "es2016", with a comment (see below).
  • lib stays at es7 on 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). importHelpers was turned off on purpose in #4573, and it would add a runtime dependency.

Why Jest stays at es2016: Sentry.init replaces the global Promise with React Native's polyfill (reactnativeerrorhandlersutils.ts). __awaiter and Babel's async-to-generator helper both build promises from that global. Native async always uses the engine's built-in promises. In apps, @react-native/babel-preset still converts async to generators (unless the unstable_preserveAsync experiment is on), so the runtime behavior is unchanged. Keeping Jest at es2016 matches that. With es2018, 37 tests in reactnavigation.ttid.test.tsx and profiling/integration.test.ts fail, 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, native async). 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-native will now get native async from the SDK. Tests that relied on fake timers to flush SDK async work may need an extra await. The commonly recommended transformIgnorePatterns whitelist 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?

  • Clean yarn build (deleted dist): no __awaiter/__rest left. The only remaining helpers are __createBinding/__exportStar from one CommonJS export * 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).
  • Production Metro bundles of samples/react-native (RN 0.88, --dev false --minify true), before vs after:
Platform Before After Δ
Android 5,223,602 B 5,214,926 B −8,676 B
iOS 6,366,908 B 6,358,228 B −8,680 B

__awaiter occurrences in the bundle drop from 27 to 6 (the remaining 6 come from other packages). The number of native async functions in the bundle is unchanged, which confirms Metro still converts the SDK's async code.

  • Not run locally: old-architecture, Expo, and native sample builds. These rely on ready-to-merge CI.

📝 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

  • Add the ready-to-merge label for the full sample/E2E CI (old/new architecture, Expo).
  • Ship in a minor release, not a patch.

🤖 Generated with Claude Code

antonis and others added 2 commits October 28, 2026 09:40
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>
@github-actions

github-actions Bot commented Oct 28, 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).


  • build(core): Compile SDK to ES2018 to drop inlined TS helpers by antonis and claude in #6957
  • chore(deps): update React Native to v0.88.1 by antonis and claude with github-actions in #6962
  • chore(deps): update Cocoa SDK to v9.32.0 by github-actions in #6963
  • test(e2e): Widen WebView demo-page trace poll window to de-flake e2e by antonis and claude in #6950
  • chore(deps): bump qs from 6.16.0 to 6.17.0 by antonis and claude with dependabot in #6960
  • chore(deps): update JavaScript SDK to v10.77.1 by antonis and claude in #6952
  • fix(ios): Don't crash on a null DSN in sentry.options.json by antonis and claude in #6958
  • build(deps): Pin follow-redirects to patched 1.16.1+ to resolve credential-leak advisories by antonis and claude in #6949
  • fix(ios): Start native SDK without options file by trollixx in #6956
  • build(node): Bump Node to 22.23.4 by geoffg-sentry with sentry-junior in #6954
  • fix(tracing): Support Expo Router 58 in expoRouterIntegration by alwx in #6923
  • fix(android): Persist hard-crash envelopes to disk before the process exits by alwx in #6937
  • feat(tracing): Track WebView trace-propagation feature adoption by antonis and claude in #6938
  • build(deps): Bump body-parser to 2.4.0 to resolve DoS advisory by antonis and claude in #6948
  • fix(android): Apply screenshot masking options to error and feedback screenshots by antonis and claude in #6930
  • chore(deps): update Android SDK to v8.62.0 by github-actions in #6932
  • chore(deps): update Maestro to v2.12.0 by github-actions in #6945
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.35.0 to 3.0.0 by dependabot in #6944
  • chore(deps): bump the codeql-action group with 3 updates by dependabot in #6940
  • chore(deps): bump actions/upload-artifact from 7.0.1 to 7.0.2 by dependabot in #6941
  • chore(deps): bump fast-uri from 3.1.8 to 3.1.9 by antonis and claude with dependabot in #6946
  • chore(deps): bump undici from 6.29.0 to 6.29.1 by dependabot in #6947
  • chore(deps): bump actions/setup-node from 7.0.0 to 7.1.0 by dependabot in #6943
  • chore(deps): bump ruby/setup-ruby from 1.327.0 to 1.334.0 by dependabot in #6942

Plus 4 more


🤖 This preview updates automatically when you update the PR.

@antonis antonis added the ready-to-merge Triggers the full CI test suite label Oct 28, 2026
@sentry

sentry Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
Sentry RN io.sentry.reactnative.sample 8.32.0 (112) Release

⚙️ sentry-react-native Build Distribution Settings

@cursor cursor Bot 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 f1bb829. Configure here.

@antonis
antonis marked this pull request as ready for review October 28, 2026 10:28
@antonis
antonis requested review from a team and lucas-zimerman as code owners October 28, 2026 10:28
@antonis
antonis merged commit f167c0d into main Oct 29, 2026
88 checks passed
@antonis
antonis deleted the build/es2018-target branch October 29, 2026 10:12
@retyui

retyui commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

@antonis thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Triggers the full CI test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid inlining TypeScript helpers (__rest, __awaiter) in every file of dist/js

3 participants