Skip to content

feat(core): Add includeFeedback Metro option to exclude feedback widget from bundle#6025

Merged
antonis merged 7 commits intomainfrom
feat/metro-include-feedback
Apr 24, 2026
Merged

feat(core): Add includeFeedback Metro option to exclude feedback widget from bundle#6025
antonis merged 7 commits intomainfrom
feat/metro-include-feedback

Conversation

@antonis
Copy link
Copy Markdown
Contributor

@antonis antonis commented Apr 20, 2026

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Adds an includeFeedback option to SentryMetroConfigOptions (used by both withSentryConfig and getSentryExpoConfig). When set to false, a Metro resolver returns { type: 'empty' } for any module matching @sentry(?:-internal)?/feedback, removing the web user-feedback widget from the bundle.

Example:

const config = getSentryExpoConfig(__dirname, {
  includeFeedback: false,
});

Also factored the shared resolver logic into buildSentryPackageExcludeResolver, so withSentryResolver (replay) and the new withSentryFeedbackResolver no longer duplicate the resolver body.

💡 Motivation and Context

Users who do not use the feedback feature are still paying for @sentry-internal/feedback in their bundle (see the expo-atlas screenshot in the linked issue). The existing includeWebReplay option solves the same problem for replay; this PR mirrors that pattern for feedback.

Closes #5629

💚 How did you test it?

  • Added unit tests in packages/core/test/tools/metroconfig.test.ts for the new withSentryFeedbackResolver, covering:
    • includeFeedback true/false/undefined across web/android/ios/null platforms
    • Both @sentry-internal/feedback and @sentry/feedback module names
    • Falls through to the original resolver for non-feedback modules
    • Old-Metro (<0.68) fallback path with process.exit(-1)
  • yarn test:tools — 254 passed
  • yarn test (full suite) — passing
  • yarn lint — passing
  • yarn circularDepCheck — passing
  • yarn build — passing

📝 Checklist

🔮 Next steps

…et from bundle

Mirrors the existing `includeWebReplay` option. When set to `false`,
`@sentry-internal/feedback` (and related subpackages) are resolved to an
empty module, removing the web user-feedback widget from the bundle.

Refactored the shared resolver logic into `buildSentryPackageExcludeResolver`
so `withSentryResolver` and the new `withSentryFeedbackResolver` both call
into it instead of duplicating the resolver body.

Closes #5629
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 20, 2026

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).


  • feat(core): Add includeFeedback Metro option to exclude feedback widget from bundle by antonis in #6025
  • feat(core): Expose scope-level attributes API by antonis in #6009
  • chore(deps): Force basic-ftp >=5.3.0 to fix GHSA-rp42-5vxx-qpwr by antonis in #6024
  • feat(core): Add GlobalErrorBoundary for non-rendering errors by alwx in #6023
  • chore(deps): update CLI to v3.4.0 by github-actions in #6026
  • feat: Expose screenshot masking options for error screenshots by antonis in #6007
  • fix(replay): Check captureReplay return value in iOS bridge by antonis in #6008
  • chore(deps): bump getsentry/craft from 2.25.2 to 2.25.4 by dependabot in #6019
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.25.2 to 2.25.4 by dependabot in #6021
  • chore(deps): bump github/codeql-action from 4.35.1 to 4.35.2 by dependabot in #6022
  • chore(deps): bump actions/setup-node from 6.3.0 to 6.4.0 by dependabot in #6020
  • ci(danger): Demote Android SDK version mismatch from fail to warn by antonis in #6018
  • chore(deps): update Android SDK to v8.39.1 by github-actions in #6010
  • chore(deps): update JavaScript SDK to v10.49.0 by github-actions in #6011
  • ci: Integrate Warden for AI-powered PR code review by antonis in #6003
  • chore(lint): Fixes lint issue on main by antonis in #6013
  • feat(expo): Warn when prebuilt native projects are missing Sentry config by alwx in #5984

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 20, 2026

Fails
🚫 Pull request is not ready for merge, please add the "ready-to-merge" label to the pull request
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 395d462

Comment thread CHANGELOG.md Outdated
@antonis
Copy link
Copy Markdown
Contributor Author

antonis commented Apr 20, 2026

@sentry review

@antonis
Copy link
Copy Markdown
Contributor Author

antonis commented Apr 20, 2026

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 d82da05. Configure here.

@antonis antonis marked this pull request as ready for review April 20, 2026 11:37
@alwx alwx assigned alwx and unassigned alwx Apr 20, 2026
Comment thread packages/core/src/js/tools/metroconfig.ts Outdated
alwx
alwx previously requested changes Apr 21, 2026
Copy link
Copy Markdown
Contributor

@alwx alwx left a comment

Choose a reason for hiding this comment

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

Added one small comment

antonis added 2 commits April 21, 2026 14:20
…eExcludeResolver

Addresses review feedback: bare `include` is ambiguous in the helper —
`includePackage` makes the intent obvious alongside `moduleRegex`.
Comment thread packages/core/src/js/tools/metroconfig.ts Outdated
Comment thread packages/core/src/js/tools/metroconfig.ts
Comment thread CHANGELOG.md Outdated
- Expose scope-level attributes API (`setAttribute`, `setAttributes`, `removeAttribute`) bridging to native SDKs ([#6009](https://github.com/getsentry/sentry-react-native/pull/6009))
- Expose screenshot masking options (`screenshot.maskAllText`, `screenshot.maskAllImages`, `screenshot.maskedViewClasses`, `screenshot.unmaskedViewClasses`) for error screenshots ([#6007](https://github.com/getsentry/sentry-react-native/pull/6007))
- Warn Expo users at Metro startup when prebuilt native projects are missing Sentry configuration ([#5984](https://github.com/getsentry/sentry-react-native/pull/5984))
- Add `includeFeedback` Metro config option to exclude `@sentry-internal/feedback` from the bundle ([#6025](https://github.com/getsentry/sentry-react-native/pull/6025))
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.

since a release was done on main branch, this changelog may be out of sync

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated with 395d462

antonis added 2 commits April 24, 2026 10:40
Addresses review feedback from @lucas-zimerman: mirror the
`includeWebReplay` naming to make it obvious the option only affects
the web feedback package, not the native feedback integration.

Also moves the changelog entry from 8.9.1 (where it landed during the
merge with main) to Unreleased since this change hasn't shipped yet.
antonis added a commit to getsentry/sentry-docs that referenced this pull request Apr 24, 2026
- Rename `includeFeedback` to `includeWebFeedback` (mirrors the SDK
  rename in getsentry/sentry-react-native#6025 after @lucas-zimerman's
  feedback).
- Reword the intro to frame the bundle-size options around "not
  targeting React Native for Web", per @lucas-zimerman's suggestion.
@antonis antonis requested a review from lucas-zimerman April 24, 2026 09:05
Copy link
Copy Markdown
Collaborator

@lucas-zimerman lucas-zimerman left a comment

Choose a reason for hiding this comment

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

LGTM!

@antonis antonis dismissed alwx’s stale review April 24, 2026 13:06

Issue tackled in 395d462

@antonis antonis merged commit 8cd4c97 into main Apr 24, 2026
55 of 61 checks passed
@antonis antonis deleted the feat/metro-include-feedback branch April 24, 2026 13:06
antonis added a commit to getsentry/sentry-docs that referenced this pull request Apr 30, 2026
…ro options (#17423)

## DESCRIBE YOUR PR

Adds a new \"Reduce Bundle Size\" section to the [React Native
Metro](https://docs.sentry.io/platforms/react-native/manual-setup/metro/)
page describing how to exclude the web Session Replay and User Feedback
packages from the bundle for users who don't need them.

Covers two Metro Plugin options:

- \`includeWebReplay\` — already exists in the SDK but was previously
undocumented.
- \`includeFeedback\` — new in an upcoming Sentry React Native SDK
release, added in
[getsentry/sentry-react-native#6025](getsentry/sentry-react-native#6025)
(closes
[getsentry/sentry-react-native#5629](getsentry/sentry-react-native#5629)).

> Note: there's a \`TODO\` in the doc pinning the exact SDK version for
\`includeFeedback\` — will update before merge once the SDK release is
cut.

## IS YOUR CHANGE URGENT?

- [ ] Urgent deadline (GA date, etc.):
- [ ] Other deadline:
- [x] None: Not urgent, can wait up to 1 week+

⚠️ Should be merged after
getsentry/sentry-react-native#6025 is shipped

## SLA

- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've
added an urgent due date to it.
Thanks in advance for your help!

## PRE-MERGE CHECKLIST

- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)
- [ ] SDK version for \`includeFeedback\` confirmed in the Alert callout

## EXTRA RESOURCES

- [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
coolguyzone pushed a commit to getsentry/sentry-docs that referenced this pull request May 1, 2026
…ro options (#17423)

## DESCRIBE YOUR PR

Adds a new \"Reduce Bundle Size\" section to the [React Native
Metro](https://docs.sentry.io/platforms/react-native/manual-setup/metro/)
page describing how to exclude the web Session Replay and User Feedback
packages from the bundle for users who don't need them.

Covers two Metro Plugin options:

- \`includeWebReplay\` — already exists in the SDK but was previously
undocumented.
- \`includeFeedback\` — new in an upcoming Sentry React Native SDK
release, added in
[getsentry/sentry-react-native#6025](getsentry/sentry-react-native#6025)
(closes
[getsentry/sentry-react-native#5629](getsentry/sentry-react-native#5629)).

> Note: there's a \`TODO\` in the doc pinning the exact SDK version for
\`includeFeedback\` — will update before merge once the SDK release is
cut.

## IS YOUR CHANGE URGENT?

- [ ] Urgent deadline (GA date, etc.):
- [ ] Other deadline:
- [x] None: Not urgent, can wait up to 1 week+

⚠️ Should be merged after
getsentry/sentry-react-native#6025 is shipped

## SLA

- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've
added an urgent due date to it.
Thanks in advance for your help!

## PRE-MERGE CHECKLIST

- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)
- [ ] SDK version for \`includeFeedback\` confirmed in the Alert callout

## EXTRA RESOURCES

- [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
Sign up for free to 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.

Add a Metro config flag (similar to includeWebReplay) to remove @sentry-internal/feedback from the bundle

3 participants