[BUG] presence of overrides
prevents hoisting when updating workspace dependencies
#7019
Open
2 tasks done
Labels
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
If the root
package.json
defines anyoverrides
, if you attempt to update a hoisted workspace dependency (either vianpm install <specifier> --save-exact -w <workspace>
or by editing itspackage.json
and runningnpm install
), it always becomes un-hoisted, even if you have setprefer-dedupe=true
This is a contributing factor to #7018 and #7028
Expected Behavior
Packages should generally be hoisted, especially when
prefer-dedupe=true
.If you remove the root-level
overrides
, it works as expected.Steps To Reproduce
Given
package.json
:And
packages/my-cool-package/package.json
:Run:
npm i [email protected] --save-exact -w my-cool-package
(hoisted tonode_modules/tiny-invariant
) ✅npm i [email protected] --save-exact -w my-cool-package
(un-hoisted topackages/my-cool-package/node_modules/tiny-invariant
) ❌Note that if you
npm i tiny-invariant@... --save-exact -w my-cool-package
a third time, it will re-hoist it 🤔 (and un-hoist it the fourth time, etc.)Environment
The text was updated successfully, but these errors were encountered: