Skip to content

Commit 73b75ac

Browse files
SaadnajmiCopilot
andcommitted
Bazel: import React/ReactNativeDependencies as dynamic frameworks (fixes app launch)
The SPM prebuild ships React.framework and ReactNativeDependencies.framework as dynamic frameworks (dylibs), but they were imported via apple_static_xcframework_import, so rules_apple linked them with @rpath load commands without embedding them. The app crashed at launch in dyld: 'Library not loaded: @rpath/React.framework/Versions/A/React'. Importing all three (React, ReactNativeDependencies, hermes) as dynamic embeds them in Contents/Frameworks. Verified: RNTesterMacBazel.app now launches and stays running (loads the embedded Metro bundle + Hermes offline). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0104b7a commit 73b75ac

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tools/bazel/apple/prebuilt_xcframeworks.bzl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ _REL_PATHS = {
1717
}
1818

1919
# hermes ships as a dynamic framework; React + deps are static.
20-
_DYNAMIC = {"hermes": True}
20+
# The SPM prebuild ships all three as dynamic frameworks (dylibs), so they must be
21+
# imported as dynamic and embedded in the app's Contents/Frameworks (otherwise dyld
22+
# fails at launch with "Library not loaded: @rpath/React.framework/...").
23+
_DYNAMIC = {"React": True, "ReactNativeDependencies": True, "hermes": True}
2124

2225
def _prebuilt_xcframeworks_impl(rctx):
2326
root = str(rctx.workspace_root)

0 commit comments

Comments
 (0)