# babel-plugin-react-native-web

> Babel plugin for React Native for Web

Latest version **0.21.4** (published 2026-10-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-react-native-web
pnpm add babel-plugin-react-native-web
yarn add babel-plugin-react-native-web
bun add babel-plugin-react-native-web
```

## Health

**Score 60/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score; popular repo.

Warnings: low downloads; no types; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.21.4 |
| Published | 2026-10-08 |
| First published | 2017-12-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 22161 |
| Author | Nicolas Gallagher |
| Maintainers | necolas, zoontek |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-react-native-web
- Repository: https://github.com/necolas/react-native-web
- Homepage: https://github.com/necolas/react-native-web#readme
- Issues: https://github.com/necolas/react-native-web/issues
- npm.io page: https://npm.io/package/babel-plugin-react-native-web

## Recent versions

- 0.21.4 (latest) — 2026-10-08
- 0.21.3 — 2026-09-25
- 0.21.2 — 2025-10-16
- 0.21.1 — 2025-08-20
- 0.21.0 — 2025-07-25
- 0.20.0 — 2025-04-03
- 0.19.13 — 2024-10-17
- 0.19.12 — 2024-05-22
- 0.19.11 — 2024-04-22
- 0.19.10 — 2023-12-24
- 0.19.9 — 2023-09-19
- 0.19.8 — 2023-08-24
- 0.19.7 — 2023-07-20
- 0.19.6 — 2023-06-28
- 0.19.5 — 2023-06-16
- … 133 more at https://npm.io/package/babel-plugin-react-native-web/versions

## README

# babel-plugin-react-native-web

[![npm version][package-badge]][package-url] [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://reactjs.org/docs/how-to-contribute.html#your-first-pull-request)

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

```
npm install --save-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**

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

**After**

```js
import StyleSheet from 'react-native-web/dist/exports/StyleSheet';
import View from 'react-native-web/dist/exports/View';
```

[package-badge]: https://img.shields.io/npm/v/babel-plugin-react-native-web.svg?style=flat
[package-url]: https://www.npmjs.com/package/babel-plugin-react-native-web

---
_Source: https://npm.io/package/babel-plugin-react-native-web · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
