React Native Bundle Discovery

Report format (metro-stats.json)

Structure of the JSON report generated by createSerializer, BundleDiscoveryPlugin and bundleDiscoveryRollipopPlugin.

createSerializer (Metro), BundleDiscoveryPlugin (Re.Pack) and bundleDiscoveryRollipopPlugin (Rollipop) write the report as a single JSON file, metro-stats.json by default. The UI and CLI read it.

The UI and CLI also accept an Rsdoctor report and an esbuild metafile as is. Those files have their own formats and are not described here.

Example

metro-stats.json
{
  "date": 1791147980685,
  "entryPoint": "/Users/me/MyApp/index.js",
  "rootFolder": "/Users/me/MyApp",
  "transformOptions": {
    "dev": false,
    "minify": true,
    "platform": "ios",
    "type": "module",
    "unstable_transformProfile": "default",
    "customTransformOptions": {}
  },
  "envs": {},
  "packages": [
    {
      "name": "metro-runtime",
      "absolutePath": "/Users/me/MyApp/node_modules/metro-runtime",
      "version": "0.87.0",
      "metadata": {
        "createdAt": "2026-07-13T15:27:34.375Z",
        "deprecated": false,
        "isLatest": false,
        "latestVersion": "0.87.1"
      }
    }
  ],
  "modules": [
    {
      "path": "/Users/me/MyApp/node_modules/metro-runtime/src/polyfills/require.js",
      "source": { "code": "\"use strict\";…", "lineCount": 727, "sizeInBytes": 21843 },
      "output": { "code": "!(function(e){…", "lineCount": 1, "sizeInBytes": 2119 },
      "dependencies": []
    }
  ]
}

Root object

FieldTypeDescription
kindstring?Bundler that created the report: metro, webpack (Re.Pack) or rollipop.
datenumberWhen the report was created (Unix time in milliseconds).
entryPointstringAbsolute path to the bundle entry file.
rootFolderstringProject root (projectRoot option). The UI shows module paths relative to it.
transformOptionsTransformOptionsOptions the bundle was built with.
envsRecord<string, string | undefined>Values of the environment variables listed in includeEnvs. Empty object by default.
packagesPackage[]Every installed copy of a package that has modules in the bundle, sorted by name.
modulesModule[]Every module of the bundle, including Metro's pre-modules such as __prelude__ and polyfills.

TransformOptions

Copied from Metro's transform options, so it can contain extra fields.

FieldTypeDescription
devbooleantrue for a development bundle. Production reports have false.
minifybooleanWhether the output code is minified.
platformstringTarget platform, for example ios or android.
typestring?Module type, for example module.
unstable_transformProfilestring?Metro transform profile, for example default or hermes-stable.
customTransformOptionsRecord<string, unknown>?Custom options passed to the transformer.

Package

One entry per installed copy: if two versions of a package end up in the bundle, both are listed with different absolutePaths. That's how duplicates are detected.

FieldTypeDescription
namestringPackage name, for example react-native or @babel/runtime.
absolutePathstringAbsolute path to the package folder inside node_modules.
versionstringInstalled version from the package's package.json.
metadataPackageMetadata | null, optionalInfo from the npm registry. Missing when fetchPackagesMetadata: false, null when the lookup failed.

PackageMetadata

FieldTypeDescription
createdAtstring | nullPublish date of the installed version (ISO 8601).
deprecatedstring | falseDeprecation message of the installed version, or false.
isLatestbooleanWhether the installed version is the latest one.
latestVersionstring | nullThe latest version on npm.

Module

FieldTypeDescription
pathstringAbsolute path to the file, or a virtual name such as __prelude__.
sourceCodeThe original file, before transformation.
outputCodeThe transformed code as it appears in the bundle. Bundle sizes in the UI and CLI use it.
dependenciesDependency[]Modules this module imports.

Code

FieldTypeDescription
codestringThe code itself. Empty string with includeCode: false, and for image and font assets in source.
lineCountnumberNumber of lines.
sizeInBytesnumberSize in bytes (UTF-8). Always present, even when code is empty.

Dependency

FieldTypeDescription
namestringThe import specifier as written in the code, for example ./utils.
absolutePathstringResolved path of the imported module (matches its path).

The "Imported by" graph and "Why is this in my bundle?" chains are built from dependencies.

With includeCode: true (the default) source.code and output.code contain your source code. Be careful who you share the report with.

On this page