Files
react-native-web/packages/babel-plugin-react-native-web
Nicolas Gallagher 87fdd6c73b [change] 'react-native-web' module organization and exports
The patch reorganizes the top-level module division of the
'react-native-web' project.

Previously, the package's exported modules were found in:

    apis/*/index.js
    components/*/index.js
    components/*/*.js
    modules/*/index.js
    propTypes/*.js

Now, each part of the exported API is found in:

    exports/*/index.js

And anything not directly part of the exported API is found in:

    modules/*/index.js
    vendor/*/index.js

Close #748
2018-01-04 14:30:24 -08:00
..
2017-12-24 12:33:41 +00:00
2017-12-24 12:33:41 +00:00
2017-12-24 12:33:41 +00:00

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

import { StyleSheet, View } from 'react-native';

After

import StyleSheet from 'react-native-web/dist/apis/StyleSheet';
import View from 'react-native-web/dist/components/View';