mirror of
https://github.com/oven-sh/bun
synced 2026-02-17 14:22:01 +00:00
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>