79205185

Date: 2024-11-19 22:07:42
Score: 0.5
Natty:
Report link

As I've learned more about pnpm, I believe it uses symlinks for local/monorepo references, which would mean it's simply a link to the folder within the monorepo.

I really wish pnpm's documentation would publicize this better. The main problem with it is that a developer could very easily import something as follows...

import {CustomError} from 'common/src/errors/custom.error';

...even if that file is not exposed in the public api for the module - really no better than relative pathing. If the module were then to be published as an actual npm package, all that code would break.

I would have liked it if pnpm would honor the public api of a module, even when used locally in a monorepo, or at least honor the "files" property in package.json. This would promote good, modular coding. Perhaps it's impossible. If anyone knows of a workaround to honor a library's public api in a pnpm monorepo, I'd love to hear about it.

Reasons:
  • Blacklisted phrase (1): anyone knows
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
Posted by: Tim Hardy