-
Notifications
You must be signed in to change notification settings - Fork 24.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add FORCE/SKIP_BUNDLING flags for iOS builds #14731
Conversation
Everyone has different workflows for this. Can you instead make this script look for an environment variable that can be set by your xcodeproj, e.g. SKIP_BUNDLING? |
Anything running in Debug should use the packager; no need to bundle. This saves a huge amount of time during development. The code being modified was originally introduced in facebook@9ae3714 to speed up builds on the simulator, but the change can be applied to real devices, too.
e.g. ``` export SKIP_BUNDLING=true ../node_modules/react-native/packager/react-native-xcode.sh ```
Thanks for the feedback @javache, I've rebased and added the flag you mentioned. I like this even better now. |
Cool! Let's keep the old behaviour too when you don't specify either of these options. |
@javache is there a particular reason you want to keep the old behavior? I'm happy to do so, but to me it seems buggy that it would need to bundle every time just for the device. By default (e.g. after using CRNA) there doesn't seem to be any reason why a physical device would need special treatment. The original commit that caused the code to be like this doesn't seem to care whether it's a simulator or physical device; what's relevant is |
Because we shouldn't assume that people will see this commit and enable FORCE_BUNDLING. The current version is a good set of defaults: e.g. you want to install a quick debug build on your phone so you can play it when disconnected from your computer, so let's keep them. |
@javache updated. That reasoning makes sense. |
@javache has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
@cooperka Have you tested the SKIP_BUNDLING flag after a clean of your build folder? I don't think it will work unless you have hard-coded the IP of your development workstation somewhere else. If running on a physical device, the bundling step is providing an I think this means that even if you are loading the bundle from the packager, you still need a bundle to be included in your ipa so that it can find the packager's IP address. I was able to get around this by still running the section of code in |
@emusgrave thanks for the detailed context. I didn't dig that deep because it seemed to work for me, but if that file is removed during cleaning, I can see how that would cause problems. Feel free to submit a PR 💯 |
why is this not included by default in the HelloWorld template of the
I mean, why would a new project create the bundle when in dev mode? |
Motivation
See discussion below for updated motivation.
Anything running in Debug should use the packager anyway; no need to bundle. This saves a huge amount of time during development when testing things like push notifications that require a real device.
The code being modified was originally moved here in 9ae3714 to make sure bundles are always created in
Release
, but the change can be applied to real devices, too. Ideally there should be very little difference in how a simulator is treated compared to a physical device.Test Plan
Run a Debug build in Xcode targeting a physical device before and after this commit.
You can use the
FORCE_BUNDLING
andSKIP_BUNDLING
flags to manually change the default behavior. For example, under Build Phases > Bundle React Native code and images:export SKIP_BUNDLING=true ../node_modules/react-native/packager/react-native-xcode.sh