Skip to content

Bug: "resolutions" trumps --ignore-optional #6040

@joscha

Description

@joscha

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

bug

What is the current behavior?

Currently, when there are resolutions defined, --ignore-optional is ignored and the optional dependencies are installed anyway.

You can test it with a simple package.json:

{
  "name": "test-optional",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "optionalDependencies": {
    "fsevents": "^1.0.0"
  },
  "resolutions": {
    "fsevents": "^1.2.4"
  }
}

on yarn install --ignore-optional the above will lead to fsevents being installed nonetheless.

On Linux (Ubuntu Xenial) for example, this would fail the yarn install due to:

error [email protected]: The platform "linux" is incompatible with this module.
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

yarn install --ignore-optional works as expected with:

{
  "name": "test-optional",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "optionalDependencies": {
    "fsevents": "^1.0.0"
  }
}

and does not install fsevents.

What is the expected behavior?

No optional dependencies to be installed with --ignore-optional, no matter whether they are mentioned in resolutions or not.

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

yarn 1.7.0
Node 10.5.0
OSX High Sierra and Debian Xenial

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions