babel-plugin-react-native

2.0.0 • Public • Published

babel-plugin-react-native

Features

This plugin was created to allow tree-shaking when building for multiple react-native platforms.

Install

npm install --save-dev --save-exact babel-plugin-react-native

Example

Source:

import { Platform } from 'react-native';

if (Platform.OS === 'web') {
  console.log('web');
} else {
  console.log('not web');
}

Transformed to (with OS: "web"):

if ('web' === 'web') {
  console.log('web');
} else {
  console.log('not web');
}

Usage

Via babel.config.json

{
  "plugins": [["babel-plugin-react-native", { "OS": "web" }]]
}

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.0
    9
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.0
    9
  • 1.0.1
    1
  • 1.0.0
    0

Package Sidebar

Install

npm i babel-plugin-react-native

Weekly Downloads

10

Version

2.0.0

License

ISC

Unpacked Size

12.4 kB

Total Files

13

Last publish

Collaborators

  • churpeau