Skip to content

NPM lockfile versions do not match #111

@TomCaserta

Description

@TomCaserta

For context:

So I have a little different of a use case to the main 'firebase' one that others seem to have but it seems to mostly need to achieve the same things. In effect what I want to be able to do is take a package from my monorepo with all its dependencies (as in, able to be npm instaled later) and place its built artefacts into a docker image.

The issue I'm having is that the lockfile is re-generated from scratch in the isolated package and it pays no attention to the current lock file at the workspace root. This means if one of the dependencies are not pinned correctly it could cause a difference in execution between running any code inside my isolated package vs my monorepo itself.

Of course, ideally my package files would be well defined and any dependencies should be pinned or at least specify a proper version range, but this isn't always the case and I think the default behaviour of effectively ignoring the workspace lockfile could be dangerous to those not aware of this.

This is why I believe this may be a bug. I did some testing myself and managed to get it to work if I copied the workspace package-lock.json to the isolateDir in generate-npm-lockfile.ts and then await arborist.loadVirtual() before building the ideal tree. I'm not too well versed in using the arborist package (so that last step may be unnecessary) but this seemed to generate a lockfile as I expected with the same dependencies as were defined in the workspace itself.

Please let me know if you need any more information.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions