Metro CLI Options

The metro command line runner has a number of useful options. You can run metro --help to view all available options. Here is a brief overview:

build <entry>

Generates a JavaScript bundle containing the specified entrypoint and its descendants.

Options

OptionAliasDescriptionValue
outOFile name where to store the outputString
platformpWhich platform to bundle forweb, android, ios
minifyzWhether Metro should minify the bundleBoolean
devgCreate a development version of the build (process.env.NODE_ENV = 'development')Boolean
configcLocation of the metro.config.js to useString
max-workersjThe number of workers Metro should parallelize the transformer onNumber
project-rootsPThe root folder of your projectArray
source-mapWhether Metro should generate source mapsBoolean
source-map-urlURL where the source map can be foundString
legacy-bundlerWhether Metro should use the legacy bundlerBoolean

serve

Starts Metro on the given port, building bundles on the fly.

get-dependencies

Lists dependencies.

Options

OptionDescription
entry-fileAbsolute path to the root JS file
outputFile name where to store the output, ex. /tmp/dependencies.txt
platformThe platform extension used for selecting modules
transformerSpecify a custom transformer to be used
max-workersSpecifies the maximum number of workers the worker-pool will spawn for transforming files. This defaults to the number of the cores available on your machine.
devIf false, skip all dev-only code path
verboseEnables logging