babel-plugin-react-native-web
Babel plugin for React Native for Web
Last updated 3 months ago by necolas .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install babel-plugin-react-native-web 
SYNC missed versions from official npm registry.

babel-plugin-react-native-web

npm version PRs Welcome

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", { commonjs: true }]
  ]
}

You should configure the plugin to match the module format used by your bundler. Most modern bundlers will use a package's ES modules by default (i.e., if package.json has a module field). But if you need the plugin to rewrite import paths to point to CommonJS modules, you must set the commonjs option to true.

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/exports/StyleSheet';
import View from 'react-native-web/dist/exports/View';

Current Tags

  • 0.11.7                                ...           latest (3 months ago)

55 Versions

  • 0.11.7                                ...           3 months ago
  • 0.11.6                                ...           3 months ago
  • 0.11.5                                ...           5 months ago
  • 0.11.4                                ...           6 months ago
  • 0.11.3                                ...           6 months ago
  • 0.11.2                                ...           8 months ago
  • 0.11.1                                ...           8 months ago
  • 0.11.0                                ...           8 months ago
  • 0.10.1                                ...           8 months ago
  • 0.10.0                                ...           10 months ago
  • 0.9.13                                ...           a year ago
  • 0.9.12                                ...           a year ago
  • 0.9.11                                ...           a year ago
  • 0.9.10                                ...           a year ago
  • 0.9.9                                ...           a year ago
  • 0.9.8                                ...           a year ago
  • 0.9.7                                ...           a year ago
  • 0.9.6                                ...           a year ago
  • 0.9.5                                ...           a year ago
  • 0.9.4                                ...           a year ago
  • 0.9.3                                ...           a year ago
  • 0.9.2                                ...           a year ago
  • 0.9.1                                ...           a year ago
  • 0.9.0                                ...           a year ago
  • 0.8.11                                ...           a year ago
  • 0.8.10                                ...           a year ago
  • 0.8.9                                ...           a year ago
  • 0.8.8                                ...           a year ago
  • 0.8.7                                ...           a year ago
  • 0.8.6                                ...           a year ago
  • 0.8.5                                ...           a year ago
  • 0.8.4                                ...           a year ago
  • 0.8.3                                ...           a year ago
  • 0.8.2                                ...           a year ago
  • 0.8.1                                ...           a year ago
  • 0.8.0                                ...           a year ago
  • 0.7.3                                ...           a year ago
  • 0.7.2                                ...           2 years ago
  • 0.7.1                                ...           2 years ago
  • 0.7.0                                ...           2 years ago
  • 0.6.1                                ...           2 years ago
  • 0.6.0                                ...           2 years ago
  • 0.5.4                                ...           2 years ago
  • 0.5.3                                ...           2 years ago
  • 0.5.2                                ...           2 years ago
  • 0.5.1                                ...           2 years ago
  • 0.5.0                                ...           2 years ago
  • 0.4.0                                ...           2 years ago
  • 0.3.3                                ...           2 years ago
  • 0.3.1                                ...           2 years ago
  • 0.3.0                                ...           2 years ago
  • 0.3.0-rc.4                                ...           2 years ago
  • 0.3.0-rc.3                                ...           2 years ago
  • 0.3.0-rc.2                                ...           2 years ago
  • 0.3.0-rc.1                                ...           2 years ago

Copyright 2014 - 2016 © taobao.org |