Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Getting Started with React Native

You're reading from   Getting Started with React Native Learn to build modern native iOS and Android applications using JavaScript and the incredible power of React

Arrow left icon
Product type Paperback
Published in Dec 2015
Publisher
ISBN-13 9781785885181
Length 172 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Generating the static bundle in iOS


So far, we have been serving the application's static bundle (where all of our JavaScript code lives) from a node server started by either Xcode or a terminal using react-native start. Before we create releases for iOS and Android, we need to generate the static JS bundle that our application will load. We will begin by creating the release in iOS; for Android, skip to the generating the Android APK section.

Once again, we are going to use the react-native-cli and execute the bundle command. The bundle command requires three flags: c, platform, and bundle-output. The entry-file specifies the path to the root component, the platform is either iOS or Android, and bundle-output is the path to place the generated bundle.

From the terminal in the root directory, run react-native bundle with an entry-file of index.ios.js, platform iOS, and point the path of the bundle-output to ios/main.jsbundle:

$ react-native bundle --entry-file index.ios.js --platform ios -...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image