npm.io
0.87.0 • Published 1 week ago

@react-native/babel-preset

Licence
MIT
Version
0.87.0
Deps
33
Size
21 kB
Vulns
0
Weekly
0
Stars
126.3K

@react-native/babel-preset

npm npm downloads

Babel preset for React Native applications. React Native uses this Babel preset by default when transforming your app's source code.

You only need to use this preset directly if you provide a custom babel.config.js file in your project's root directory. React Native does not apply its default Babel configuration in that case, so you must specify all the plugins necessary to transform your code — start from this preset to get the defaults and add more plugins on top.

Usage

Installation

Install @react-native/babel-preset in your app:

with npm:

npm i @react-native/babel-preset --save-dev

or with yarn:

yarn add -D @react-native/babel-preset
Configuring Babel

Then, create a file called babel.config.js in your project's root directory. The existence of this babel.config.js file tells React Native to use your custom Babel configuration instead of its own. Then load this preset:

{
  "presets": ["module:@react-native/babel-preset"]
}

You can further customize your Babel configuration by specifying plugins and other options. See Babel's babel.config.js documentation to learn more.

Keywords