From 978d165c78b5ab6062fcaf947e4b34ea459fa269 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Tue, 21 Apr 2026 14:32:10 +0200 Subject: [PATCH 1/2] feat(react-native): Document includeWebReplay and includeFeedback Metro options Adds a "Reduce Bundle Size" section to the React Native Metro page describing how to exclude the web Session Replay and User Feedback packages from the bundle for users who don't need them. includeFeedback is new in the upcoming Sentry React Native SDK release (getsentry/sentry-react-native#6025). includeWebReplay has existed for a while but was previously undocumented. --- .../react-native/manual-setup/metro.mdx | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/docs/platforms/react-native/manual-setup/metro.mdx b/docs/platforms/react-native/manual-setup/metro.mdx index 9e49a5dfcdbc4..bc88e4ef31b91 100644 --- a/docs/platforms/react-native/manual-setup/metro.mdx +++ b/docs/platforms/react-native/manual-setup/metro.mdx @@ -72,6 +72,41 @@ const config = getSentryExpoConfig(__dirname, { }); ``` +### Reduce Bundle Size + +If you're not using the Session Replay or User Feedback features, you can exclude their web-only packages from the bundle by opting out via the Metro Plugin options. When set to `false`, the Sentry Metro Plugin resolves the matching Sentry sub-packages to an empty module so they're not included in the output bundle. + +| Option | Default | Effect when set to `false` | +| ------------------ | ------- | ------------------------------------------------------------------------ | +| `includeWebReplay` | `true` | Excludes `@sentry/replay` and `@sentry-internal/replay` from the bundle. | +| `includeFeedback` | `true` | Excludes `@sentry-internal/feedback` from the bundle. | + +Note that these options only affect bundling. They do not disable the corresponding native (Android/iOS) integrations. + +```javascript {tabTitle:React Native} {filename:metro.config.js} +const { getDefaultConfig } = require("@react-native/metro-config"); +const { withSentryConfig } = require("@sentry/react-native/metro"); + +const config = getDefaultConfig(__dirname); +module.exports = withSentryConfig(config, { + includeWebReplay: false, + includeFeedback: false, +}); +``` + +```javascript {tabTitle:Expo} {filename:metro.config.js} +const { getSentryExpoConfig } = require("@sentry/react-native/metro"); + +const config = getSentryExpoConfig(__dirname, { + includeWebReplay: false, + includeFeedback: false, +}); +``` + + +`includeFeedback` requires `@sentry/react-native` version 8.9.0 or newer. + + ### Wrap Your Custom Serializer If you already have a custom serializer, you can wrap it with the Sentry Metro Serializer and call `options.sentryBundleCallback` before serializing the bundle content. From 77896fada2bfaf658cb1c278a1a17528d98a527c Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Tue, 21 Apr 2026 14:34:04 +0200 Subject: [PATCH 2/2] Remove alert --- docs/platforms/react-native/manual-setup/metro.mdx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/platforms/react-native/manual-setup/metro.mdx b/docs/platforms/react-native/manual-setup/metro.mdx index bc88e4ef31b91..660baf0a73dc2 100644 --- a/docs/platforms/react-native/manual-setup/metro.mdx +++ b/docs/platforms/react-native/manual-setup/metro.mdx @@ -103,10 +103,6 @@ const config = getSentryExpoConfig(__dirname, { }); ``` - -`includeFeedback` requires `@sentry/react-native` version 8.9.0 or newer. - - ### Wrap Your Custom Serializer If you already have a custom serializer, you can wrap it with the Sentry Metro Serializer and call `options.sentryBundleCallback` before serializing the bundle content.