pnpm-isolate-workspace
pnpm-isolate-workspace copied to clipboard
`pnpm-lock.yaml` can never be used together with `package-prod.json`
Hey @Madvinking !
I am looking for a tool to isolate a PNPM workspace and found your package. I spent several hours yesterday and today trying to prepare our PNPM Monorepo productively on a Docker image Dockerfile, unfortunately to no avail. Now and then another error flies up, and it seems to me that there is no real solution for it yet. I will briefly reference other issues here that have to do with this topic:
- https://github.com/pnpm/pnpm/issues/3114
- https://github.com/pnpm/pnpm/issues/881
- https://github.com/pnpm/pnpm/issues/3442
- https://github.com/pnpm/pnpm/discussions/3367#discussioncomment-2974231
Another feature I have now discovered is that PNPM with NODE_ENV=production does not allow workspaces to be created locally, but they must be available in the NPM registry. This leads me to the conclusion that for the final Docker build I need a pnpm-lock.yaml which contains only productive dependencies: pnpm-lock-prod.yml so I can avoid pnpm --prod or publish all our packages to a registry which isn't an option for us. By the way, the same applies to pnpm deploy.
Having now tested pnpm-isolate-workspace, I have found that the package-prod.json is unusable without a prepared pnpm-lock-prod.yaml (or I haven't quite figured out how to use it yet), as the lockfile obviously doesn't match.

In relation to https://github.com/Madvinking/pnpm-isolate-workspace/pull/11 (especially this comment), is it possible that we can create another file pnpm-lock-prod.yaml? I have tried to get into the coding to open a PR, but currently understand too little about PNPM and its APIs.
Have a look at isolate-package I think it does everything you need.