Hacker News new | ask | show | jobs
by 3np 924 days ago
This consideration ins't really unique to pnpm but manifest in different ways across the package managers.

Basically you have a choice between sharing or isolating state, specifically package cache, between containers.

If you go full-on isolation, indeed the performance benefits of pnp go away and you'll redundantly pull down and install packages for every container. Here you might look into running a local registry (like Nexus or verdaccio) to push the cache there, and maybe disabling pnp alltogether.

If you go full-on-sharing, you might consider why you're even using Docker for development in the first place and not just nvm?

You have varying options in-between of course, like a per-project cache (so you still share between a directory tree but not machine-wide).

You'd do this by also mounting the appropriate path inside the home-dir of the container.

> I can easily gitignore it but I don't really see other people doing this.

Don't let the cargo-cult blind your own judgement on what best-practice mean for your project. And try refer to primary sources first, rather than third-party examples and random forums, in the future https://github.com/orgs/pnpm/discussions/6936 :)