React Native in ES6 with webpack and Babel
It's possible to write React Native apps in ES6+ using
Check better approach using
DependencyGraph module: dep-graph.
Basically you need to compile everything to
index.ios.js file, which is then transformed by
react-native. Also, to stop webpack from trying to load native (Objective-C) components, you need to define them all as
externals and set
libraryTarget: 'commonjs' in webpack config, this way webpack will not resolve
require to native components.
webpack.config.js for build configuration.
Before running the project, change code location in
localhost to run on iOS Simulator or to your computer's IP address to run on device.
Run in the terminal
webpack --config webpack.config.js, open another tab and run
- No support for ES6 classes. There's no
React.Componentor any other extendable base class.