fix: embedded debug bundle in Expo dev mode - #391
Merged
Conversation
artus9033
marked this pull request as ready for review
June 22, 2026 11:31
artus9033
approved these changes
Jun 22, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Expo iOS framework Debug embedded bundle behavior so embedded bundles are generated with dev-mode transforms disabled, and refines Debug bundle URL resolution to prefer Metro when available while allowing an embedded-bundle fallback when Metro is unavailable.
Changes:
- Force embedded framework Debug bundling to pass
--dev falseviaEXTRA_PACKAGER_ARGS(CI/local scripts + Expo config-plugin rewrite). - Update iOS runtime bundle URL resolution behavior/docs to “Metro first in Debug, embedded fallback when enabled”.
- Add/adjust regression tests for the config-plugin rewrite and SwiftPM bundle URL resolver behavior; add Node test coverage for Detox simulator device selection.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/ci-local-ios-e2e-common.sh | Ensures Detox/CI embedded bundle builds disable dev transforms via EXTRA_PACKAGER_ARGS. |
| packages/react-native-brownfield/src/expo-config-plugin/ios/xcodeHelpers.ts | Injects --dev false into the rewritten Xcode bundling phase for framework targets. |
| packages/react-native-brownfield/src/expo-config-plugin/ios/tests/xcodeHelpers.test.ts | Adds assertions ensuring the rewrite includes the new EXTRA_PACKAGER_ARGS export. |
| packages/react-native-brownfield/ios/Vanilla/ReactNativeHostRuntime.swift | Uses fallbackURLProvider: { nil } for Metro URL detection; clarifies Debug embedded fallback semantics. |
| packages/react-native-brownfield/ios/Expo/ExpoHostRuntime.swift | Same Metro URL fallback behavior for Expo runtime delegate; updates Debug fallback docs. |
| packages/react-native-brownfield/ios/ReactNativeBrownfield.swift | Updates API docs to match “Debug fallback when Metro unavailable”. |
| packages/react-native-brownfield/ios/swiftpm/Sources/BrownfieldBundleSupport/BrownfieldBundleURLResolver.swift | Changes Debug resolution to prefer Metro when available, with optional embedded fallback. |
| packages/react-native-brownfield/ios/swiftpm/Tests/BrownfieldBundleSupportTests/BrownfieldBundleURLResolverTests.swift | Splits/updates tests to cover Metro-first + embedded-fallback behavior. |
| apps/brownfield-example-shared-tests/package.json | Enables Node test runner for .test.cjs files. |
| apps/brownfield-example-shared-tests/e2e/expoPostMessageBrownfield.e2e.js | Refactors E2E navigation into a helper (but currently leaves Detox sync disabled). |
| apps/brownfield-example-shared-tests/detox-ios-simulator-device.cjs | Refactors simulator selection to prefer installed simulators over uncreated device types. |
| apps/brownfield-example-shared-tests/detox-ios-simulator-device.test.cjs | Adds Node tests for simulator device selection behavior. |
| .changeset/expo-debug-embedded-bundle.md | Changeset documenting the patch release. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
450
to
454
| export function rewriteBundleReactNativePhaseScriptForFrameworkTarget( | ||
| shellScript: string | ||
| ): string { | ||
| const debugBundlingOverride = `# Brownfield framework packaging must embed JS in Debug builds. | ||
| if [[ "$CONFIGURATION" = *Debug* ]]; then |
hurali97
approved these changes
Jun 22, 2026
hurali97
left a comment
Member
There was a problem hiding this comment.
LGTM, Please verify Copilot's comments!
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
Summary
--dev falseto the React Native bundling script.Root cause
Expo debug bundles generated for embedded framework use were still emitted with JS dev mode enabled. When the host app loaded that embedded bundle without the Expo/Metro dev server, Expo devtools code attempted to create dev-server websocket endpoints and threw
Cannot create devtools websocket connections in embedded environments.Impact
Debug framework packaging can still embed JS, but the embedded bundle now behaves like a server-independent bundle instead of depending on Expo dev-server-only runtime paths.
Validation
EXTRA_PACKAGER_ARGSoverride.yarn workspace @callstack/react-native-brownfield testbrownfield-navigation-drift, turbotypecheck, turbolint