mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-20 05:31:28 +00:00
3026465ae3
Introduces a monorepo structure, relies on yarn workspaces to share
dependencies, and lerna for syncing versions across the monorepo.
* Create 2 workspaces:
'packages' and 'website'
* Create 2 public packages:
'babel-plugin-react-native-web' and 'react-native-web'
* Create 1 private package:
'benchmarks'
A simple release script runs the tests, builds the package assets,
increments the package version numbers, git commits and tags, publishes
the package to npm, pushes the changes to github, and releases the
website update.
Close #657
40 lines
756 B
Markdown
40 lines
756 B
Markdown
# babel-plugin-react-native-web
|
|
|
|
A Babel plugin that will alias `react-native` to `react-native-web` and exclude
|
|
any modules not required by your app (keeping bundle size down).
|
|
|
|
## Installation
|
|
|
|
```
|
|
yarn add --dev babel-plugin-react-native-web
|
|
```
|
|
|
|
## Usage
|
|
|
|
**.babelrc**
|
|
|
|
```
|
|
{
|
|
"plugins": ["react-native-web"]
|
|
}
|
|
```
|
|
|
|
## Example
|
|
|
|
NOTE: `react-native-web` internal paths are _not stable_ and you must not rely
|
|
on them. Always use the Babel plugin to optimize your build. What follows is an
|
|
example of the rewrite performed by the plugin.
|
|
|
|
**Before**
|
|
|
|
```js
|
|
import { StyleSheet, View } from 'react-native';
|
|
```
|
|
|
|
**After**
|
|
|
|
```js
|
|
import StyleSheet from 'react-native-web/dist/apis/StyleSheet';
|
|
import View from 'react-native-web/dist/components/View';
|
|
```
|