Skip to content

fix: workaround wrong bundle command specify by core react-native scripts when archiving#115

Merged
thymikee merged 4 commits intomainfrom
fix/archive-bundle-workaround
Jan 27, 2025
Merged

fix: workaround wrong bundle command specify by core react-native scripts when archiving#115
thymikee merged 4 commits intomainfrom
fix/archive-bundle-workaround

Conversation

@thymikee
Copy link
Contributor

@thymikee thymikee commented Jan 23, 2025

Summary

This code in RN core points to some custom bundle script if CLI_PATH env variable is not set, and this custom bundle script expects --config-cmd to be present.

As a way to work around it, I'm adding extra integration instructions to the docs to edit "Bundle React Native code and images" Build Phase, setting custom CLI_PATH and CONFIG_CMD, and add a dummy --config-cmd command to Metro's bundle command (Re.Pack already supports that)

Credits to @jbroma for testing this in prod and integrating into Re.Pack in callstack/repack#869

Test plan

Running:

pnpm rnef build:ios --archive --verbose --mode Release

works without installing RNC CLI

image

README.md Outdated
+if [[ -f "$PODS_ROOT/../.xcode.env.local" ]]; then
+source "$PODS_ROOT/../.xcode.env.local"
+fi
+export CONFIG_CMD="dummy"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why export CONFIG_CMD?

@thymikee thymikee merged commit a916b27 into main Jan 27, 2025
1 check passed
@thymikee thymikee deleted the fix/archive-bundle-workaround branch January 27, 2025 10:26
{
name: '--config-cmd [string]',
description:
'Hack for Xcode build script pointing to wrong bundle command that recognizes this flag.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we mark with something like (internal)? because it shouldn't be for external use

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah why not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants