When fighting with some tools working not as expected, it is always good to read an insightful commit message.

Especially if it’s your own commit message, from 8 months ago.

chore: set some-package resolution to 2.0.0

I used the following command:

   yarn set resolution some-package@npm:^1.0.4 2.0.0

This caused the lock file to be modified. There is no additional entry inside top-level package.json.

What’s more, yarn documentation mentions -s option that should “Persist the resolution inside the top-level manifest”1, but it is not implemented according to an answer from 20202.

What’s more, resolutions in package.json and yarn set resolution are totally different features…

And then the next message afterwards:

chore: decided to use package.json resolutions

Putting a new entry inside package.json is more developer-friendly – the approach with yarn set resolution leaves no info other than the lockfile itself, which if regenerated, loses the information about the forced resolution.

The only downside is that it’s now harder to parse the lockfile on its own, cause the lockfile mentions version 2.0.0 which is not requested by any package (contrary to yarn set resolution which kept declarated range as “^1.0.4” and only modified the actual resolution version).

I checked the issue and the --saved flag is still mentioned in the docs, and still not implemented. The save = Option.Boolean(`-s,--save`) variable just sits here, patiently waiting to be deleted.


  1. https://yarnpkg.com/cli/set/resolution ↩︎

  2. https://github.com/yarnpkg/berry/issues/2202#issuecomment-737788770 ↩︎