{"id":26160,"library":"react-native-esbuild","title":"react-native-esbuild","description":"A fast bundler and dev server for React Native that leverages esbuild instead of Metro. Current stable version is 0.6.0, with updates supporting React Native 0.72. Typically released every few months. Key differentiators: 10-50x faster bundling, tree shaking resulting in ~21% smaller bundles, drop-in replacement for Metro, support for custom transformers and environment variables. Peer dependencies include @babel/core >=7.0.0 and esbuild >=0.17. Compatible with out-of-tree platforms (macOS, Windows) and offers interactive mode.","status":"active","version":"0.6.0","language":"javascript","source_language":"en","source_url":"git://github.com/oblador/react-native-esbuild","tags":["javascript","react-native","esbuild","dev-server","development","bundler"],"install":[{"cmd":"npm install react-native-esbuild","lang":"bash","label":"npm"},{"cmd":"yarn add react-native-esbuild","lang":"bash","label":"yarn"},{"cmd":"pnpm add react-native-esbuild","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for Babel transformations","package":"@babel/core","optional":true},{"reason":"Peer dependency, the core bundler engine","package":"esbuild","optional":false}],"imports":[{"note":"CommonJS require is standard for react-native.config.js; ESM import may not work depending on Node configuration.","wrong":"import { commands } from 'react-native-esbuild';","symbol":"commands","correct":"const { commands } = require('react-native-esbuild');"},{"note":"Named export; default import does not work.","wrong":"import createEsbuildCommands from 'react-native-esbuild';","symbol":"createEsbuildCommands","correct":"const { createEsbuildCommands } = require('react-native-esbuild');"},{"note":"babelPlugin is a named export from the main entry, not a separate file.","wrong":"const babelPlugin = require('react-native-esbuild/babelPlugin');","symbol":"babelPlugin","correct":"const { babelPlugin } = require('react-native-esbuild');"}],"quickstart":{"code":"// Configure react-native-esbuild as a CLI plugin\n// File: react-native.config.js\nconst { commands, createEsbuildCommands, babelPlugin } = require('react-native-esbuild');\n\n// Option 1: Use default commands\nmodule.exports = { commands };\n\n// Option 2: Customize with createEsbuildCommands\nconst customCommands = createEsbuildCommands((config) => ({\n  ...config,\n  plugins: config.plugins.concat(\n    babelPlugin({\n      filter: /src\\/my-babel-components\\/.+\\.tsx?$/\n    })\n  )\n}));\n\nmodule.exports = { commands: customCommands };\n\n// Then run:\n// npx react-native esbuild-start --port 8081\n// npx react-native esbuild-bundle --platform android --dev false","lang":"javascript","description":"Shows how to configure react-native-esbuild as a CLI plugin, with optional custom esbuild configuration and Babel plugin, then run start or bundle commands."},"warnings":[{"fix":"Remove usage of esmCustomMainFieldResolverPlugin; esbuild 0.17+ handles main fields automatically.","message":"esmCustomMainFieldResolverPlugin is deprecated and no longer needed with esbuild >= 0.17.","severity":"deprecated","affected_versions":">=0.5.0"},{"fix":"Update package.json scripts: change 'start' script to 'react-native esbuild-start' and ensure --no-packager is appended to ios/android scripts.","message":"The dev server must be started with 'react-native esbuild-start' instead of 'react-native start' (Metro). Using the wrong command will launch Metro instead of esbuild.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"If using Flow or Reanimated, ensure your files are properly annotated; the loader now actively processes these syntaxes and may throw errors for malformed code.","message":"Version 0.4.0 introduced a flow/reanimated syntax-aware loader that may change behavior for files containing Flow or Reanimated code; previous versions may have failed silently.","severity":"breaking","affected_versions":">=0.4.0"},{"fix":"Upgrade to 0.4.0 or later to avoid source map crashes.","message":"Source map support was fixed in 0.4.0; earlier versions experienced crashes related to source maps.","severity":"gotcha","affected_versions":"<0.4.0"},{"fix":"If using Windows or macOS targets, upgrade to 0.3.0 or later.","message":"Support for out-of-tree platforms (macOS, Windows) was added in 0.3.0; previous versions only supported iOS and Android.","severity":"breaking","affected_versions":"<0.3.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'yarn add react-native-esbuild esbuild' or 'npm install react-native-esbuild esbuild'.","cause":"Package is not installed or not in node_modules.","error":"Error: Cannot find module 'react-native-esbuild'"},{"fix":"Use correct import: const { commands } = require('react-native-esbuild'); not import commands from 'react-native-esbuild';","cause":"Incorrectly importing commands as an array instead of an object with a commands key.","error":"TypeError: commands is not iterable"},{"fix":"Add --platform android or --platform ios to the bundle command.","cause":"Missing --platform argument in esbuild-bundle.","error":"error: No platform specified"},{"fix":"Update esbuild to >=0.17: 'yarn upgrade esbuild --latest' or 'npm install esbuild@latest'.","cause":"Outdated esbuild version installed.","error":"Error: esbuild version must be >=0.17"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}