Skip to content

Bug in selective resolution of nested packages? #4585

Closed

Description

@TomiS

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

bug

What is the current behavior?

Resolutions defined in a direct dependency of the app are not respected even if they are not in any conflict with app dependencies.

If the current behavior is a bug, please provide the steps to reproduce.

See this example repository that represents accurately a real life problem:
https://github.com/TomiS/yarn-selective-resolution-bug

  • Root package.json is an example of an "app" that utilizes so-called "platform" with multiple dependencies
  • Platform has multiple dependencies exactly defined (in this example only react-virtualized-select and react-virtualized)
  • App itself does not have other dependencies than the platform
  • Clone repository and run yarn install in the root folder AND in the platform folder to get lock files for app and platform
  • In real life, platform would be another repository, but that does not affect the behaviour.

What is the expected behavior?

  • App gets near identical lock file with same deps as platform

  • This is what I'd expect in the app lock file: Platform yarn.lock

  • This is what I get: App (root) yarn.lock

  • This happens even if plaform contains this resolution: Resolution line in platform

  • Current workaround is to define exact resolutions also in app package.json but this is very unsatisfying solution as there can be hundreds of apps using the same platform and duplication of those resolutions is not something what we want. I know this is not the most common way to manage deps with Yarn nor the simplest use case but I also wouldn't expect we are unique with this approach. So this report is mainly to raise discussion if this is intended behaviour.

Please mention your node.js, yarn and operating system version.

Node: 6.9.4
Yarn: 1.1.0
OSX

ps. Selective resolutions is an awesome feature and Yarn is great in general. Thanks for that.

Activity

  1. assigned and unassigned on Sep 29, 2017
  2. BYK commented on Oct 3, 2017

    @BYK
    Member

    Hey @kaylieEB can you look at this?

  3. kaylie-alexa commented on Oct 5, 2017

    @kaylie-alexa
    Member

    @BYK yup, i'll work on this during the weekend.

  4. kaylie-alexa commented on Oct 5, 2017

    @kaylie-alexa
    Member

    Well actually thinking about this, I think the intended use case wasn't for selective resolutions to be respected for nested dependencies and only be used at the project level. We theoretically could do something like use the resolution of each dependency level then override them again at the project level, but this seems like adding a lot of complexity. Thoughts @cpojer @yarnpkg/core ?

  5. cpojer commented on Oct 5, 2017

    @cpojer
    Contributor

    Yep, resolutions are only meant to work within a project, just like yarn.lock files. I think that's the right design decision and this feature is meant to give control to the user of a project rather than the library authors.

  6. kaylie-alexa commented on Oct 5, 2017

    @kaylie-alexa
    Member

    thanks for clarifying @cpojer

    @TomiS closing this for now as you mentioned

    Current workaround is to define exact resolutions also in app package.json

    is the intended use of selective resolutions

  7. TomiS commented on Oct 9, 2017

    @TomiS
    Author

    Fair enough. We'll just need to find another approach. Thanks for clarification. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions