Metro Bundler
JavaScript bundler for React Native that compiles app code and serves it to iOS, Android, and web development environments.
Metro is the default JavaScript bundler used by React Native to transform, bundle, and serve application code during development and build time. It takes JavaScript or TypeScript source files, resolves dependencies, and produces optimized bundles that can be executed on mobile devices or simulators.
Metro is designed specifically for React Native’s architecture, prioritizing fast incremental builds and rapid feedback loops. It supports features like hot reloading and fast refresh, enabling developers to see changes instantly without rebuilding the entire application.
The bundler runs as a development server that serves JavaScript bundles over HTTP. React Native apps connect to this server to fetch the latest compiled code. Metro also handles asset management, source maps, and platform-specific resolution (such as iOS vs Android module resolution).
It is highly configurable and integrates deeply with React Native CLI, Expo, and modern React Native tooling. Developers can extend Metro through transformers, resolvers, and custom middleware to adapt bundling behavior for complex applications or monorepos.
Metro is optimized for large-scale applications with thousands of modules and uses caching, parallel processing, and file watching to maintain performance even in large codebases.
Key features include:
- Fast JavaScript and TypeScript bundling for React Native
- Incremental builds with fast refresh support
- Dependency graph resolution and module system handling
- Built-in asset handling (images, fonts, etc.)
- Configurable transformers, resolvers, and middleware
- Deep integration with React Native and Expo ecosystems
Common use cases include:
- Bundling React Native applications during development
- Serving live reload updates to mobile devices
- Building production JavaScript bundles
- Managing assets and module resolution
- Supporting cross-platform React Native workflows
Metro is maintained by Meta (Facebook) as part of the React Native ecosystem.
Comments
0Markdown is supported.