Skip to content

Instantly share code, notes, and snippets.

View dvins's full-sized avatar
🚀
Ad Astra!

David Vins dvins

🚀
Ad Astra!
View GitHub Profile
@dvins
dvins / pnpm-peerdependency-override.md
Last active November 16, 2024 12:07
Overriding A Peer Dependency With PNPM

Overriding A Peer Dependency With PNPM

This guide explains how to override peer dependencies in a PNPM monorepo by using a custom hook. It provides a step-by-step solution to ensure consistent versioning across packages that rely on different versions of the same dependency.

Background

When working with a monorepo a challenges arises if you need to use multiple versions of the same package.

Nominally, this can be solved through package aliases and overides. However, a particularly sticky situation is when downstream packages rely peer dependencies of uptstream packages you need two or more versions of.