LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

metro

JavaScript bundler used by React Native

TLDR

Start Metro bundler
$ npx react-native start
copy
Start with cache reset
$ npx react-native start --reset-cache
copy
Start on specific port
$ npx react-native start --port [8082]
copy
Bundle for production
$ npx react-native bundle --platform [android] --dev false --entry-file [index.js] --bundle-output [bundle.js]
copy
Enable verbose logging
$ npx react-native start --verbose
copy

SYNOPSIS

metro [options]

DESCRIPTION

Metro is the JavaScript bundler used by React Native. It compiles and bundles JavaScript code and assets, handles module resolution, and provides hot reloading during development.Metro is optimized for React Native's requirements with fast incremental builds.

PARAMETERS

--port port

Server port.
--reset-cache
Clear bundler cache.
--verbose
Verbose output.
--config file
Config file path.
--entry-file file
Entry point file.
--bundle-output file
Output bundle file.
--platform platform
Target platform (ios, android).
--dev boolean
Development mode flag for the bundle (default: true).
--host host
Host to listen on (default: localhost).
--max-workers N
Specify the maximum number of workers for parallelization.

CONFIGURATION

$ // metro.config.js
module.exports = {
  resolver: {
    sourceExts: ['js', 'jsx', 'ts', 'tsx'],
  },
  transformer: {
    getTransformOptions: async () => ({
      transform: { experimentalImportSupport: false },
    }),
  },
};
copy

CAVEATS

React Native specific. Cache issues may require reset. Port conflicts with multiple instances.

HISTORY

Metro was developed by Facebook (Meta) as the bundler for React Native, optimized for mobile development workflows.

SEE ALSO

react-native(1), webpack(1), babel(1), expo(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid