Yarn: Yarn resolutions only works with fixed versions not dist-tags

Created on 12 Nov 2018  路  3Comments  路  Source: yarnpkg/yarn

Do you want to request a feature or report a bug?
bug

Yarn resolutions only works with fixed versions, not dist-tags

What is the current behavior?
Yarn installs react@latest not react@next

If the current behavior is a bug, please provide the steps to reproduce.
run the yarn install on the following package.json document

{ "name": "yarn-test", "version": "1.0.0", "license": "ISC", "private": true, "resolutions": { "react": "next" }, "dependencies": { "react": "latest" } }

What is the expected behavior?
Yarn installs react@next not react@latest

Please mention your node.js, yarn and operating system version.
yarn: 1.12.3
node: 8.11.4
os: Windows 10

cat-feature help wanted

Most helpful comment

This is still reproduced 1 year after issue was created.

All 3 comments

When debugging this with the current code from master I noticed the warning:

warning Resolution field "next" has an invalid version entry and may be ignored
[1/4] 馃攳  Resolving packages...

This comes from: https://github.com/yarnpkg/yarn/blob/master/src/resolution-map.js#L69-L72

    if (!semver.validRange(range) && !getExoticResolver(range)) {
      this.reporter.warn(this.reporter.lang('invalidResolutionVersion', range));
      return null;
    }

So it looks like it wants to make sure that the resolution points to a valid semver range. This happens before the metadata for the package is loaded, so it wouldn't be easy to just check the actual tags and versions.

I'm going to tag this as a [feature-request] to support dist-tags in addition to versions. If anyone wants to work on this, help would be appreciated!

This is still reproduced 1 year after issue was created.

Still a problem here in the distant future >:(

Was this page helpful?
0 / 5 - 0 ratings