rnx-kit/incubator/polyfills
renovate[bot] 57013d2191
fix(deps): update eslint (major) (#3394)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com>
2024-10-17 14:41:52 +00:00
..
src feat(webapis): introduce `@react-native-webapis/battery-status` (#2590) 2023-10-10 13:15:23 +02:00
test test: migrate more tests to Node test runner (#3252) 2024-07-30 18:45:19 +02:00
CHANGELOG.md RELEASING: Releasing 44 package(s) (#3342) 2024-09-11 08:59:50 +02:00
README.md feat(webapis): introduce `@react-native-webapis/battery-status` (#2590) 2023-10-10 13:15:23 +02:00
eslint.config.js chore: migrate to ESLint flat config (#2782) 2023-11-03 14:02:18 +01:00
package.json fix(deps): update eslint (major) (#3394) 2024-10-17 14:41:52 +00:00
tsconfig.json feat(tsconfig): base TypeScript configs for working with Node (#2886) 2023-12-18 12:05:07 +01:00

README.md

@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