https://github.com/roman01la/react-native-babel
Configuration to build React Native apps with ES6 using webpack and Babel
https://github.com/roman01la/react-native-babel
Last synced: 8 months ago
JSON representation
Configuration to build React Native apps with ES6 using webpack and Babel
- Host: GitHub
- URL: https://github.com/roman01la/react-native-babel
- Owner: roman01la
- License: mit
- Archived: true
- Created: 2015-03-28T02:18:25.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-04T10:40:03.000Z (over 9 years ago)
- Last Synced: 2025-03-24T19:56:19.507Z (8 months ago)
- Language: Objective-C
- Size: 34.2 KB
- Stars: 233
- Watchers: 7
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-react-native - react-native-babel ★241
- awesome-react-native - react-native-babel ★241
- awesome-react-native - react-native-babel ★241
- awesome-react-native - react-native-babel ★241
- awesome-react-native-ui - react-native-babel ★238
- awesome-react-native - react-native-babel ★241
README
# React Native in ES6 with webpack and Babel
## DEPRECATED!
It's possible to write React Native apps in ES6+ using `babel-loader` and `webpack`.
Check better approach using `DependencyGraph` module: [dep-graph](https://github.com/roman01la/react-native-babel/tree/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.
Check [`ignore-modules.js`](ignore-modules.js) for the regexp to match all native components, it is extracted using approach described in [dep-graph](https://github.com/roman01la/react-native-babel/tree/dep-graph) branch.
Check `webpack.config.js` for build configuration.
## Usage
Before running the project, change code location in [`iOS/AppDelegate.m`](https://github.com/roman01la/react-native-babel/blob/master/iOS/AppDelegate.m#L29) to `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 `react-native start`.
## Known limitations
- No support for ES6 classes. There's no `React.Component` or any other extendable base class.