packall
Guides

Versions and platforms

Bundle every version matching a range, and the native binaries the target machine needs.

Every version matching a range

By default a range resolves to one version — the best match. --all-versions expands it to every published version that satisfies the range, each with its own closure:

packall react@^19 --all-versions

This is what you want when the team behind the firewall needs room to move: they can install any 18.x without another trip across the air gap.

It can be a lot of tarballs. --max-versions keeps the newest N:

packall react@^19 --all-versions --max-versions 5

Prereleases never satisfy a range unless you ask:

packall react@^19 --include-prerelease

Native binaries

Packages with native code — esbuild, rollup, sharp, @parcel/watcher — publish their binaries as a set of per-platform sibling packages and list all of them under optionalDependencies. npm installs only the one matching your machine.

So optional dependencies are included by default, for every platform. Bundle on a Mac with the rest skipped and the bundle installs fine on your Mac and fails on the Linux CI box inside the firewall — the only place it actually matters.

Narrow it deliberately when you know the target:

packall tsdown --platform win32,linux

An OS on its own means every architecture for it, which is usually what you want, and it keeps working when a package later adds an arm64 build. Go narrower when you need to:

packall tsdown --platform linux-x64-musl

windows, macos and osx are accepted and corrected to win32 and darwin. An unrecognised OS is rejected rather than quietly matching nothing — a bundle missing every binding is the exact failure this is here to prevent.

To skip optional dependencies entirely:

packall esbuild --no-optional

Peer dependencies

Non-optional peer dependencies are followed, because npm 7+ auto-installs them and will reach for the network if they are missing. --no-peer turns that off.

--no-optional and --no-peer both make the bundle smaller by leaving out things an install may go looking for. If the target network is genuinely air-gapped, a missing package is an install failure with no fallback.

On this page