-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add flag to ignore individual optional packages #5251
Comments
This is vaguely related to #4611, which encompasses more complicated scenarios. |
One use case for this is
A yarn.lock file generated on a Mac will include this dependency, so when code is deployed to a CI system running ubuntu, yarn finishes with an exit code 1. It would be nice to ignore this dependency in a particular environment. |
same problem with fsevents and camunda/camunda-bpm-sdk-js |
Another use case: the "pm2" package has an optional dependency on "gkt", which is a dummy module (it just has a console.log() statement), hosted on Unitech's servers instead of npm. They use this setup for their own analytics. There's currently an issue with how they're serving the module, which prevents installing "pm2". It would be nice to say "don't install any optional dependency called 'gkt', it's not needed". |
pm2 again: Unitech/pm2#4993 |
Do you want to request a feature or report a bug?
Request a feature.
What is the current behavior?
Currently there is no way to suppress individual optional packages while retaining others, since
--ignore-optional
is a global flag which suppresses all optional packages.What is the suggested behavior?
I suggest the repeatable flag
--suppress-optional <package-name>
, which would cause<package-name>
to be ignored if<package-name>
is a transitively-optional dependency, and would cause an error if<package-name>
is required.Motivation
This flag would help to manage overall package size by enabling the manual suppression of specific optional dependencies.
This flag would also help to suppress misbehaving optional packages. For example, a package we rely on has an optional dependency (
bad-package
) with unmanaged dependencies. That is,bad-package
requires you to separately download and build somelibfoo
before runningyarn install
, which we never do becausebad-package
isn't useful to us. Unfortunately, this causesyarn install
to always spew a lengthy warning whenbad-package
fails to install.This optional dependency is obviously misbehaving, but we can't fix it, so instead we'd like to ignore it. We can't just use
--ignore-optional
everywhere, because we do need some optional dependencies likefsevents
. With--suppress-optional bad-package
, we could selectively suppress the misbehaving package.The text was updated successfully, but these errors were encountered: