Build faster for Android using react-native with alias
Enieber Cunha
Posted on November 26, 2018
When I started developing using React Native I had some problems with the android cache, both the cache of the libs and the generated cache of the project itself. To do a simple build I had to remove folders and check for some answers in StackOverflow to handle with cache errors.
Over time, take the react-native experience with some errors and to avoid them I use some scripts that help me on a daily. To help in other projects using react-native I've created a project with some alias that you can find it on Github.
React Native Android Alias
Explaining the aliases a little more, the most used by me are:
rn-clear: In this alias I remove the entire android build folder, so I have a project without cache.
rn-start: I use this command to start the app in dev mode. It also compile the app for some devices.
ad-clear: The purpose of this command is to clear the entire project, even removing the native libs cache.
rn-server: This alias is used to start the node js server which is responsible for sending the js code to the app that is currently being developed.
Conclusions
Although the project seems not very robust, I had saved hours and hours with these aliases, because with them I can compile for a project in development mode:
rn-clear && rn-start
Or even compile for production without any problems, I just need to ensure that the project is correctly configured and have set up the keys and versioning. After that I just run this command and enjoy:
ad-clean && rn-clear && rn-release
If you have liked and want to contribute to the project, simply send a Pull Request or open an Issue in Github.
Thanks to Augusto Chmieleski for helping in the translation
Posted on November 26, 2018
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.