Conversation
marco-saia-datadog
approved these changes
Apr 28, 2026
- Babel plugin: skip all transforms when caller platform is 'web' - Metro serializer (withDatadogMetroConfig): skip debug ID injection for web - Metro serializer (Expo plugin): skip debug ID injection for web
ea455e2 to
ebd15fd
Compare
There was a problem hiding this comment.
Pull request overview
Adds platform awareness to Datadog’s React Native build tooling so web bundles don’t receive native-only instrumentation/debug-ID injection.
Changes:
- Update
@datadog/mobile-react-native-babel-pluginto skip transforms whencaller.platform === 'web'. - Update Metro serializer to skip debug ID injection for
platform === 'web'. - Add Jest coverage for web skipping in the Babel plugin and Metro serializer paths.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/react-native-babel-plugin/test/plugin.test.ts | Adds a test asserting the Babel plugin is a no-op on web builds. |
| packages/react-native-babel-plugin/src/index.ts | Adds a platform check in Program.enter to skip plugin initialization on web. |
| packages/core/src/metro/plugin/metroSerializer.ts | Skips debug ID injection for web in both serializer and Expo pre-asset hook. |
| packages/core/src/metro/tests/metro.test.ts | Adds a test verifying the serializer does not inject debug IDs for web builds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sbarrio
approved these changes
Apr 28, 2026
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.
What does this PR do?
For cross-platform React Native apps that also target web (e.g., Expo with web support), the Babel plugin and Metro serializer were running unconditionally on all platforms, injecting native-only code into web bundles.
This PR adds awareness for the web platform so that web builds are skipped:
@datadog/mobile-react-native-babel-plugin: Skips all transforms when it's 'web'. This prevents injection ofDdBabelInteractionTrackingwrappers,__ddExtractTexthelpers, and the__DD_RN_BABEL_PLUGIN_ENABLED__flag into web bundles.createDatadogMetroSerializer(used by withDatadogMetroConfig): Skips debug ID injection for web builds.unstable_beforeAssetSerializationPlugin(used by getDatadogExpoConfig): Same platform check for the Expo-specific code path.When checking on a resulting bundle for an expo app built for the web, all Datadog artifacts created by babel & expo were eliminated.
DdBabelInteractionTracking__ddExtractText_datadogDebugIdsdatadog-debug-idMotivation
Issue #1204
Additional Notes
Anything else we should know when reviewing?
Review checklist (to be filled by reviewers)