[BUG] workspace packages using different major versions of the same package causes issues #2783
Description
I had originally posted this in feedback:
npm/feedback#236 (comment)
But was requested to post here as well:
Current Behavior:
TLDR;
I need to use multiple major versions of a single package. For this the only solution is a
noHoist
option, which I can't seem to find for NPM7 workspaces.
My case:
I have a NPM7 monorepo that holds a core lib focussed on data communication with a plugin system.
Some plugin in my workspace in ./packages
use an NPM package (let's call it Y) of major version 2, while another uses Y of major version 3.
When the "docs" SPA in ./packages
uses Y at v2 as well as the plugin that uses Y at v2, the docs cannot be launched because it's giving a conflict for version of package Y. It tries to use Y at v3.
How can I prevent "Y" from being hoisted in the NPM7 workspace? It's the only issue.
Expected Behavior:
I expect to be able to
Steps To Reproduce:
I can try to set up a repo that replicates this if requested.
I had already have to stop using workspaces because of this issue, so I don't have a reproduction ready to go. But am willing to create one if requested.
Environment:
npm: 7.5.6
macOS: 11.1