Skip to main content

yarn unplug

Force the unpacking of a list of packages.

Usage

$ yarn unplug ...

Examples

Unplug the lodash dependency from the active workspace :

yarn unplug lodash

Unplug all instances of lodash referenced by any workspace :

yarn unplug lodash -A

Unplug all instances of lodash referenced by the active workspace and its dependencies :

yarn unplug lodash -R

Unplug all instances of lodash, anywhere :

yarn unplug lodash -AR

Unplug one specific version of lodash :

yarn unplug lodash@1.2.3

Unplug all packages with the @babel scope :

yarn unplug @babel/*

Unplug all packages (only for testing, not recommended) :

yarn unplug -R *

Details

This command will add the selectors matching the specified patterns to the list of packages that must be unplugged when installed.

A package being unplugged means that instead of being referenced directly through its archive, it will be unpacked at install time in the directory configured via pnpUnpluggedFolder. Note that unpacking packages this way is generally not recommended because it'll make it harder to store your packages within the repository. However, it's a good approach to quickly and safely debug some packages, and can even sometimes be required depending on the context (for example when the package contains shellscripts).

Running the command will set a persistent flag inside your top-level package.json, in the dependenciesMeta field. As such, to undo its effects, you'll need to revert the changes made to the manifest and run yarn install to apply the modification.

By default, only direct dependencies from the current workspace are affected. If -A,--all is set, direct dependencies from the entire project are affected. Using the -R,--recursive flag will affect transitive dependencies as well as direct ones.

This command accepts glob patterns inside the scope and name components (not the range). Make sure to escape the patterns to prevent your own shell from trying to expand them.

Options

DefinitionDescription

-A,--all

Unplug direct dependencies from the entire project

-R,--recursive

Unplug both direct and transitive dependencies

--json

Format the output as an NDJSON stream