Usage in monorepos
pnpm's ability to use a shared store makes it a perfect choice
for monorepo projects. But there are even more benefits you'll get!
When you work in a monorepo, you need all your dependencies linked together via
However, you also need them to be required by each other in their
This is really inconvenient for a few reasons:
- having the dependencies required as semver dependencies, will download them from the registry during installation.
npm linkprevents downloading from the registry. However, all the dependencies has to be manually linked between each other.
pnpm solves these issues with a special option called
link-local. When the
config value is set to
pnpm will do to changes in it's usual behavior:
- local dependencies will be resolved with symlinks instead of copy/pasting
- before publish, the local dependencies will be converted into semver dependencies
Here is an example monorepo to see how it works.