[V2] [Fix] Skip debug ID injection for modulesOnly bundles#1299
Merged
sbarrio merged 2 commits intoJun 15, 2026
Conversation
4 tasks
cdn34dd
approved these changes
Jun 12, 2026
| expect(code).not.toContain('_datadogDebugIds'); | ||
| }); | ||
|
|
||
| test('skips debug ID injection for modulesOnly bundles (lazy/split chunks)', async () => { |
There was a problem hiding this comment.
Pull request overview
Fixes a Metro serializer crash when Metro requests modulesOnly bundles (e.g., lazy/dynamic import split chunks) by skipping Datadog Debug ID injection for those bundles.
Changes:
- Skip Debug ID injection when
options.modulesOnlyis set, in addition to existing hot-reload and web-platform skips. - Add a unit test validating Debug ID injection is skipped for
modulesOnlybundles while still occurring for the main bundle.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/core/src/metro/plugin/metroSerializer.ts | Adds an early-return condition to bypass Debug ID injection for modulesOnly bundles. |
| packages/core/src/metro/tests/metro.test.ts | Adds regression test covering modulesOnly bundle behavior for Debug ID injection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+48
to
53
| // Skip for hot reload mode, web builds and modulesOnly bundles | ||
| if ( | ||
| (graph.transformOptions as any).hot || | ||
| graph.transformOptions.platform === 'web' | ||
| graph.transformOptions.platform === 'web' || | ||
| (options as any).modulesOnly | ||
| ) { |
cdn34dd
approved these changes
Jun 15, 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?
Reported by: #1297
The metro serializer crashed when Metro asked for a
modulesOnlybundle (lazy imports / split chunks), because those bundles don't carry apremodules section that the Debug ID injection step relies on.This fix skips running the serializer for modulesOnly=true bundles, avoiding the crash.
Motivation
The debug id implementation should not clash with the dev metro server.
Review checklist (to be filled by reviewers)