From 0a4a76dde2dedd1d0e620da7e297d2c381725253 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Wed, 28 Oct 2026 09:40:46 +0100 Subject: [PATCH 1/2] build(core): Compile SDK to ES2018 to drop inlined TS helpers 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 --- CHANGELOG.md | 4 ++++ packages/core/tsconfig.build.json | 2 +- packages/core/tsconfig.build.tools.json | 2 +- packages/core/tsconfig.json | 5 ++++- packages/core/tsconfig.lint.json | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc5208173a..bee459b645 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ ## Unreleased +### Changes + +- Compile the SDK to ES2018 to stop inlining TypeScript helpers (`__awaiter`, `__rest`) in every file, reducing bundle size ([#6955](https://github.com/getsentry/sentry-react-native/issues/6955)) + ### Fixes - Apply `screenshot` masking options to Android error and feedback screenshots ([#6930](https://github.com/getsentry/sentry-react-native/pull/6930)) diff --git a/packages/core/tsconfig.build.json b/packages/core/tsconfig.build.json index 3830039a90..2f00b608be 100644 --- a/packages/core/tsconfig.build.json +++ b/packages/core/tsconfig.build.json @@ -39,7 +39,7 @@ // react-native's global types are pulled in via the `paths` mapping above; classic `node` // resolution can no longer discover them through the removed root `types` field. "types": [], - "target": "es6", + "target": "es2018", "module": "es6", "skipLibCheck": true, "strictBindCallApply": true, diff --git a/packages/core/tsconfig.build.tools.json b/packages/core/tsconfig.build.tools.json index b6282eb9a8..cda08c0a67 100644 --- a/packages/core/tsconfig.build.tools.json +++ b/packages/core/tsconfig.build.tools.json @@ -19,7 +19,7 @@ "rootDir": "src", "lib": ["es7"], "types": ["node"], - "target": "es6", + "target": "es2018", "module": "CommonJS", "skipLibCheck": true, "importHelpers": false diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index f7754a5825..96c00a963b 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -17,6 +17,9 @@ "compilerOptions": { "rootDir": ".", "jsx": "react", - "types": ["jest"] + "types": ["jest"], + // Jest compiles with this config. Keep async/await downleveled like Metro's Babel preset does in apps, + // so SDK async code runs on the global (polyfilled) Promise that `Sentry.init` installs. + "target": "es2016" } } diff --git a/packages/core/tsconfig.lint.json b/packages/core/tsconfig.lint.json index 627f9ff27c..883ab1e652 100644 --- a/packages/core/tsconfig.lint.json +++ b/packages/core/tsconfig.lint.json @@ -54,7 +54,7 @@ "lib": ["es7"], "jsx": "react", "types": ["jest"], - "target": "es6", + "target": "es2018", "module": "es6", "skipLibCheck": true, "strictBindCallApply": true, From f1bb829b0019fa8aeb6c9bf5be4d09651818636f Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Wed, 28 Oct 2026 09:41:12 +0100 Subject: [PATCH 2/2] docs(changelog): Link PR for ES2018 target change Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bee459b645..856cde5523 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ ### Changes -- Compile the SDK to ES2018 to stop inlining TypeScript helpers (`__awaiter`, `__rest`) in every file, reducing bundle size ([#6955](https://github.com/getsentry/sentry-react-native/issues/6955)) +- Compile the SDK to ES2018 to stop inlining TypeScript helpers (`__awaiter`, `__rest`) in every file, reducing bundle size ([#6957](https://github.com/getsentry/sentry-react-native/pull/6957)) ### Fixes