Registry / web-framework / babel-preset-expo

babel-preset-expo

JSON →
library55.0.18jsnpmunverified

The official Babel preset for Expo projects, enabling JSX, modern JavaScript, and React Native / web support. Current stable version is 55.0.18. Updated regularly alongside Expo SDK releases. Automatically configures transforms for Expo modules, React Native, and React Native Web. Differentiators: seamless integration with Expo toolchain, automatic platform detection (ios/android/web), and optimized settings for Metro bundler. Requires @babel/runtime and react-refresh for development reloading.

npm install babel-preset-expo
INSTALL
IMPORT
SIG · BABEL-PRESET-EXPO
B
babel-preset-expo
web-frameworkjavascriptv55.0.18
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
module.exports = function(api) { api.cache(true); return { presets: ['babel-preset-expo'] }; }
import babelPresetExpo from 'babel-preset-expo'
Used in babel.config.js, not imported in app code. Common mistake: trying to import in JavaScript.
function
// babel.config.js module.exports = function(api) { api.cache(true); return { presets: ['babel-preset-expo'], }; };
module.exports = { presets: ['babel-preset-expo'] }
Must call api.cache() in Babel config. Omitting api.cache() can cause performance issues or stale cache.
default
.babelrc { "presets": ["babel-preset-expo"] }
Using .babelrc with invalid JSON or missing presets array
Also works in .babelrc; ensure valid JSON.

Configures Expo Babel preset in babel.config.js with optional platform override and comments on available options.

// babel.config.js module.exports = function(api) { api.cache(true); return { presets: [['babel-preset-expo', { // Options: 'ios', 'android', 'web', or 'react-native' (default auto-detects) // Uncomment to override: // platform: 'web', // react-compiler: false, // enable React Compiler (experimental) }]], plugins: [ // Additional plugins ], }; };
Debug
Known issues
breakingIn v55, expo-widgets peer dependency was added. Projects without expo-widgets may fail to install.
fix
Add 'expo-widgets': '^55.0.14' to dependencies, or install expo-widgets
affects: >=55.0.0
deprecatedThe 'lazyImports' option is deprecated. Use 'rewriteImportPath' instead.
fix
Replace 'lazyImports' with 'rewriteImportPath' in preset options.
affects: >=55.0.0
gotchaUsing babel-preset-expo with plain React (not React Native) may cause unexpected transforms for JSX and platform-specific code.
fix
For web-only projects, set platform: 'web' explicitly. For React DOM projects, consider using @babel/preset-react instead.
affects: >=50.0.0
breakingIn v50, the preset stopped bundling @babel/runtime. You must install @babel/runtime separately.
fix
Run npm install @babel/runtime --save (or --save-dev)
affects: >=50.0.0
Errors
Common errors & fixes
Requires Babel 7.12+
Using an older Babel version (<7.12)
fix
Upgrade Babel packages to ^7.12.0 or later.
Cannot find module '@babel/runtime/helpers/interopRequireDefault'
Missing @babel/runtime dependency
fix
Run: npm install @babel/runtime
Unknown plugin 'transform-remove-console'
Removed in v55; use 'expo-remove-console' plugin instead
fix
Replace 'transform-remove-console' with 'expo-remove-console' in plugins list.
Upgrade
Version history
55.0.18latest on npm
Audit
Dependencies
exporequiredpeer dependency; preset is designed for Expo projects
@babel/runtimerequiredruntime helpers for transpiled code
react-refreshoptionalenables Fast Refresh in development
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
babel-preset-expo — npm install babel-preset-expo · libregistry