0.1.1 β€’ Published 6 months ago

@rnx-kit/polyfills v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

@rnx-kit/polyfills

Build npm version

🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧

THIS TOOL IS EXPERIMENTAL β€” USE WITH CAUTION

🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧

This is a polyfills "autolinker" for React Native. It works like native module autolinking, but gathers polyfills from dependencies instead.

Motivation

Please read the Modularity section of the React Native WebAPIs RFC for its raison d'Γͺtre.

Installation

yarn add @rnx-kit/polyfills --dev

or if you're using npm

npm add --save-dev @rnx-kit/polyfills

Usage

  1. Add the Babel plugin:

     // babel.config.js
     module.exports = {
       presets: ["module:@react-native/babel-preset"],
    +  plugins: [require("@rnx-kit/polyfills")],
     };
  2. In your index.ts (or index.js), add the following comment at the top of the file:

    // @react-native-webapis