-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
With Yarn's new Plug and Play feature, if a package uses another package, it must include that other package either in dependencies
or peerDependencies
otherwise there will be a runtime resolution failure.
However some projects intentionally omit the dependency if it's for an optional feature. For example in:
waysact/webpack-subresource-integrity#90
At the moment such projects have a choice between:
- not adding the optional peer dep, and Yarn PnP not working
- adding the peer dep and making everyone install a potentially unnecessary dep to silence the "missing peer dependency" warnings during yarn install
What is the expected behavior?
To have a (backwards-compatible) way to declare a peer dependency as optional, which would allow the PnP resolver to still work, but if the optional peer dep package was not installed, there would not be a "missing peer dependency" warning shown during yarn install.
In waysact/webpack-subresource-integrity#90 (comment) this form was proposed:
{
"peerDependencies": {
"html-webpack-plugin": "optional:^x.y.z"
}
}
And in waysact/webpack-subresource-integrity#90 (comment), this:
{
"optionalPeerDependencies": {
"html-webpack-plugin": "^x.y.z"
}
}
Please mention your node.js, yarn and operating system version.
Yarn 1.12.0, all OSes.