Skip to content

[Feature] Peer dependency resolutions #4099

@aaronadamsCA

Description

@aaronadamsCA
  • I'd be willing to implement this feature (contributing guide)
  • This feature is important to have in this repository; a contrib plugin wouldn't do

Describe the user story

As a developer, I want to overwrite the version number of a peer dependency in a nested package, so that Yarn will stop warning that the installed version of the dependency doesn't satisfy the requested version, but will still check the peer dependency using the new version number I've specified.

Describe the solution you'd like

I can think of a few options, each having its own set of potential drawbacks:

  1. Create a new peerResolutions field.
  2. Allow resolutions to replace peerDependencies as well as dependencies.
  3. Allow packageExtensions to overwrite existing peer dependencies, maybe with a new syntax where I provide version: XXX and overwrite: true.

Describe the drawbacks of your solution

  1. More fields to support.
  2. I'm not sure, actually. It feels like this would be safe, but I have to imagine there's some reason it doesn't already work this way.
  3. More syntax to support, potentially dangerous, fundamentally changes the purpose of packageExtensions.

Describe alternatives you've considered

I haven't had any success ignoring the mismatched peer dependencies using peerDependenciesMeta, nor trying to adjust them with resolutions; neither seems to work.

I could use logFilters to discard matching messages, but that's not much of a solution, and doesn't suppress the warning "Some peer dependencies are incorrectly met".

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions