Files
bun.sh/test/regression
Claude Bot 0adcd694e0 fix(install): exclude optional peers resolved against dev deps in --prod
When running `bun install --production`, optional peer dependencies of
production packages (e.g. typescript as an optional peer of @prisma/client)
were incorrectly installed if they also appeared in the root devDependencies.

During the `.resolvable` tree-building phase, optional peers get resolved
against any matching dependency in the tree, including dev deps. In the
subsequent `.filter` phase, the root dev dependency is correctly filtered
out, but the optional peer retains its resolved package ID and passes
through the filter since remote_package_features.peer_dependencies is true.

The fix adds a check in the filter phase: when an optional peer dependency
from a non-root package matches a root dev dependency and dev_dependencies
are disabled (--prod mode), it is filtered out.

Closes #26837

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-09 21:13:18 +00:00
..