Allow providing pre-compiled main.jsbundle
(CI optimization)
#376
Replies: 3 comments
-
@andreialecu You can try the next way to reduce financial expenses: https://dev.to/retyui/react-native-how-speed-up-ios-build-4x-using-cache-pods-597c |
Beta Was this translation helpful? Give feedback.
-
@retyui You may want to also take a look at Subito-it/PodBuilder#10 for a less complicated solution for prebuilding pods that doesn't necessarily require I haven't been able to use other solutions for prebuilding in real-life projects (such as the ones mentioned in your article) due to various issues which are detailed in the thread above. |
Beta Was this translation helpful? Give feedback.
-
I read that Wix engineer use "expo" way to run js code on once precompile app |
Beta Was this translation helpful? Give feedback.
-
Introduction
Since MacOS compute time is generally the most expensive on CI platforms, it seems that it would be possible to reduce the amount of time taken during
xcode
compilation by skipping thereact-native bundle
compilation step.For context, I wanted to create a workflow to run
react-native bundle
on Linux VMs and then feed the pre-compiled assets to a MacOS build step further down the pipeline, but ran into issues.CircleCI specifically mentions this possibility on their RN landing page: https://circleci.com/circleci-react/
Additionally, depending on the complexity of the pipeline, the bundle could be reused or even cached in a CI workflow, greatly reducing overall processing time.
Details
There is a
SKIP_BUNDLING
env variable that is checked here: https://github.com/facebook/react-native/blob/master/scripts/react-native-xcode.sh#L30Setting
SKIP_BUNDLING=true
as an environment variable does work to skip the bundling step.However, I found it hard to figure out where to actually place the assets, because the destination folder seems to be
DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH
, which is largely unknown before runningXCode
.Discussion points
Seems like it might be a good idea to add a feature of reusing pre-built bundles.
For example, an env variable like
export RN_BUNDLE_PREBUILD_DIR=./dist/ios
could be checked and if present, the build step would simply copy the contents of that directory over to its expected$DEST
directory. It would be great if this worked for both Android and iOS. For iOS it should be a very simple change to the above.sh
script. I haven't checked Android yet.Any thoughts?
Beta Was this translation helpful? Give feedback.
All reactions