npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

metro-bundle-visualizer

v0.1.1

Published

Interactive bundle size visualizer for React Native — works with RN 0.73+, New Architecture, zero config

Readme

metro-bundle-visualizer

npm version npm downloads CI license

Interactive bundle size visualizer for React Native — works with RN 0.73+, New Architecture, zero config.

Bundle report screenshot

Quick Start

npx metro-bundle-visualizer

Run from your React Native project root. An interactive HTML treemap opens in your browser.

Installation

# one-off (recommended)
npx metro-bundle-visualizer

# or install globally
npm install -g metro-bundle-visualizer

Usage

metro-bundle-visualizer [options]

Options:
  -p, --platform <ios|android>   Platform to bundle for (default: "ios")
  --dev                          Bundle in dev mode (default: false)
  --entry <path>                 Entry file (default: auto-detected from package.json "main")
  -o, --out <path>               Output HTML path (default: "./bundle-report.html")
  --no-open                      Don't open browser automatically
  --reset-cache                  Reset Metro cache before bundling
  -V, --version                  Print version
  -h, --help                     Show help

Examples

# iOS production bundle (default)
npx metro-bundle-visualizer

# Android
npx metro-bundle-visualizer --platform android

# CI — save without opening browser
npx metro-bundle-visualizer --no-open --out ./reports/bundle.html

Expected output

metro-bundle-visualizer v0.1.0

Project:  /your/rn/project
Entry:    index.js
Platform: ios
Mode:     production

Bundling…

Bundle complete — 44.3 MB (3241 modules)

Report saved to: ./bundle-report.html
Opened in browser.

How It Works

Instead of post-processing source maps (broken on Metro 0.83+), this tool injects a custom serializer into Metro's bundling pipeline. Each module's output[0].data.code — the exact bytes Metro writes to the bundle — is captured and attributed to its package. The result is a self-contained HTML file with a D3.js treemap.

The bundle output is never altered.

Metro 0.83+ compatibility

Most bundle analysis tools for React Native rely on source maps. Metro 0.83 changed how column offsets are emitted, which breaks source-map-based attribution on RN 0.82+.

This tool never touches source maps. It hooks into Metro's serializer pipeline and reads graph.dependencies directly — the exact bytes Metro is about to write to the bundle. Sizes are accurate regardless of Metro version.

Expo async metro config. If your metro.config.js exports an async function (common with withNativeWind and other Expo config plugins), the temporary config this tool injects needs to resolve it synchronously. Wrap it in a sync IIFE in a separate base config file, then import that:

// metro.config.base.js
const cfg = require('./metro.config.original');
module.exports = typeof cfg === 'function' ? cfg() : cfg;

Or inline it:

module.exports = (() => {
  const cfg = require('./metro.config.base');
  return typeof cfg === 'function' ? cfg() : cfg;
})();

FAQ

Does it work with Expo? Yes. For Expo projects, try --entry node_modules/expo/AppEntry.js if auto-detection doesn't pick up the right entry point.

Does it work with New Architecture (Fabric / JSI)? Yes. The tool hooks into Metro's serializer directly, so it works regardless of architecture.

Can I use it in CI without opening a browser? Yes: metro-bundle-visualizer --no-open --out ./bundle-report.html

Why are sizes slightly larger than the final binary? Sizes are post-Babel-transform but pre-Terser minification. Relative proportions are accurate; absolute KB values are ~20-40% larger than what ships in the final binary.

React Native Version Support

| RN Version | Status | |------------|--------| | 0.83+ (New Architecture) | Supported | | 0.73 – 0.82 | Supported | | < 0.73 | Not tested |

Node.js 18, 20, and 22 are tested in CI across Ubuntu, macOS, and Windows.

Contributing

See CONTRIBUTING.md.

License

MIT — see LICENSE.