React Native Bundle Discovery

createSerializer

import { createSerializer } from "react-native-bundle-discovery";

Creates a Metro serializer that writes the JSON report (format). Use it as serializer.customSerializer (see Quick start).

Options

OptionTypeDefaultDescription
projectRootstringRequiredProject root. ⚠️ In a monorepo, use the monorepo root, not the app package directory.
outputJsonPathstring<projectRoot>/metro-stats.jsonWhere to save the report.
includeCodebooleantrueInclude source and bundled code of each module in the report (larger file).
includeEnvsstring[][]Names of environment variables to include in the report.
fetchPackagesMetadatabooleantrueFetch package metadata (publish date, deprecation, latest version) from the npm registry.
silentbooleanfalseDisable log output.
serializerFunctionMetro default serializerCustom serializer to wrap.

With includeCode: true (the default) the report contains your source code. If your code is proprietary, be careful who you share the report with.

On this page