package-size

Measure the size of a package and its dependencies

MIT License

Stars
3
Committers
3

Package Size (pkgsz)

Get the size of an npm package.

Usage

npx pkgsz [flags] <package name> [version]

💡 Features

  • Uses rollup to build the package (probably more accurate results in modern vite world)
  • Reports the statistics regarding node_modules size and minified / gzipped size (brotli compression is optional)
  • Supports subpath exports
  • Supports custom registries (without authentication)
  • Interactive mode

🔔 Limitations

  • If you are using something like angular size will be incorrect because this tool does not include the angular compiler (or any other UI framework / library compiler)
  • Only reports sizes in binary units (Kib, Mib, bytes)
  • Installs using npm install and not yarn / pnpm / bun etc.

🔑 Options

-i, --interactive

Interactive mode (default: false)

-b, --brotli

Calculate brotli compressed size

-c, --no-clean

Do not clean the temporary directory

-g, --no-gzip

Do not calculate gzipped size

-e, --export

Reexport given subpath from the package (default: ["."])

-r, --registry

The npm registry to use when installing the package

-s, --enable-scripts

Enable scripts

-h, --help

Show help

--version

Show version

ℹī¸ License

MIT