The Babel preset for Expo projects
Last updated 3 months ago by ide .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install babel-preset-expo 
SYNC missed versions from official npm registry.


This preset extends the default React Native preset (metro-react-native-babel-preset) and adds support for decorators, tree-shaking web packages, and loading font icons with optional native dependencies if they're installed.

You can use this preset in any React Native project as a drop-in replacement for metro-react-native-babel-preset. If your project isn't using native font loading or web support then this preset will only add support for decorators with @babel/plugin-proposal-decorators - this is mostly used for supporting legacy community libraries.

If you start your web project with @expo/webpack-config or expo start:web and your project doesn't contain a babel.config.js or a .babelrc then it will default to using babel-preset-expo for loading.

If you have problems with the code in this repository, please file issues & bug reports at Thanks!

Expo Bundler Spec Compliance

A bundler must follow these requirements if they are to be considered spec compliant for use with a universal React (Expo) project.

Babel Loader

The babel loading mechanism must include the following properties on its caller.


A platform property denoting the target platform. If the platform is not defined, it will default to using web when the bundler is webpack -- this is temporary and will throw an error in the future.

Value Description
ios Runs on iOS devices
android Runs on Android devices
web Runs in web browsers


A bundler property denoting the name of the bundler that is being used to create the JavaScript bundle. If the bundler is not defined, it will default to checking if a babel-loader is used, if so then webpack will be used, otherwise it will default to metro.

Value Description
metro Bundling with Metro
webpack Bundling with Webpack



Changes Babel's compiled import statements to be lazily evaluated when their imported bindings are used for the first time.

Note: this option has an effect only when the disableImportExportTransform option is set to false. On Android and iOS, disableImportExportTransform defaults to false, and on web it defaults to true to allow for tree shaking.

This can improve the initial load time of your app because evaluating dependencies up front is sometimes entirely un-necessary, particularly when the dependencies have no side effects.

The value of lazyImports has a few possible effects:

default: null

        lazyImports: true


Enabling this option will allow your project to run with older JavaScript syntax (i.e. module.exports). This option will break tree shaking and increase your bundle size, but will eliminate the following error when module.exports is used:

TypeError: Cannot assign to read only property 'exports' of object '#<Object>'

default: false

        web: { disableImportExportTransform: true }

Current Tags

  • 8.2.3                                ...           latest (3 months ago)

25 Versions

  • 8.2.3                                ...           3 months ago
  • 8.2.2                                ...           3 months ago
  • 8.2.1                                ...           3 months ago
  • 8.1.1 [deprecated]           ...           3 months ago
  • 8.2.0 [deprecated]           ...           3 months ago
  • 8.1.0                                ...           5 months ago
  • 8.0.0                                ...           8 months ago
  • 7.1.0                                ...           10 months ago
  • 7.0.0                                ...           a year ago
  • 7.0.0-rc.1                                ...           a year ago
  • 7.0.0-rc.0                                ...           a year ago
  • 6.0.0                                ...           a year ago
  • 5.2.0                                ...           a year ago
  • 5.1.1                                ...           a year ago
  • 5.1.0                                ...           a year ago
  • 5.0.0                                ...           2 years ago
  • 5.0.0-rc.1                                ...           2 years ago
  • 5.0.0-rc.0                                ...           2 years ago
  • 4.0.0                                ...           3 years ago
  • 3.0.0                                ...           3 years ago
  • 3.0.0-alpha.0                                ...           3 years ago
  • 2.0.0                                ...           3 years ago
  • 2.0.0-rc.0                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago

Copyright 2014 - 2016 © |