-
|
My NestJs application imports @nestjs/schedule which depends on "cron" pacakage. My own code relies on few constructors from "cron" package so I added a direct dependency on "cron" package. For my code to perfectly align with the right API and types, I had to lookup the version required in @nestjs/schedule and pin that exact version as a root dependency (which was not necessary with NPM thanks/due to "shameful" hoisting I guess). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
|
It shouldn't matter what version you install. If it needs to "perfectly align with the right API and types", then it probably needs to be a peer dependency. |
Beta Was this translation helpful? Give feedback.
If that's the only way it works, then it should be a peer dependency. It is a nestjs issue. On your side, you could use a readPackage hook to convert the dep to a peer dep (https://pnpm.io/pnpmfile#hooksreadpackagepkg-context-pkg--promisepkg). You will still need to install it as a dependency of your project. That's the only way your project will work with pnpm (or Yarn Plug'n'Play).