Files
pnpm/.changeset/optional-platform-prefetch.md
T
Zoltan Kochan 59554bef71 fix(deps-resolver): don't download unsupported-platform optional deps on fresh install (#13510)
On a fresh install, extract_children collected a resolved package's
dependencies and optionalDependencies without deduplicating. npm merges
optionalDependencies into dependencies at publish time, so registry
manifests list every platform-specific optional dependency in both maps,
and each got two resolve edges: one optional, one non-optional. The
non-optional edge bypassed the platform gate in
PrefetchingResolver::should_skip_prefetch (it only applies to optional
edges), so fresh installs prefetched the tarball of every platform
variant, e.g. all seven `@typescript/native-preview-*` packages on a
linux-x64 host. The lockfile came out correct regardless; only the
downloads were wasted.

Fold the duplicate into one optional edge keeping the dependencies
range, mirroring the TypeScript resolver's
{...optionalDependencies, ...dependencies} merge in
getNonDevWantedDependencies. The TypeScript CLI is unaffected: its
object-spread merge already collapses the duplicate key, confirmed by
byte-identical lockfiles between the two stacks on the repro.
2026-07-30 22:33:29 +02:00

155 B

pacquet
pacquet
patch

Fresh installs no longer download the tarballs of platform-specific optional dependencies that don't match the current platform.