重要提示: 此中文文档针对的是 Yarn 2 版本。
有关 1.x 版本的中文文档,请点击进入 yarn.bootcss.com。
Yarn
yarn addyarn binyarn cache cleanyarn config getyarn config setyarn configyarn constraints queryyarn constraints sourceyarn constraintsyarn dedupeyarn dlxyarn execyarn infoyarn inityarn installyarn linkyarn nodeyarn npm infoyarn npm loginyarn npm logoutyarn npm publishyarn npm tag addyarn npm tag listyarn npm tag removeyarn npm whoamiyarn packyarn patch-commityarn patchyarn plugin import from sourcesyarn plugin importyarn plugin listyarn plugin removeyarn plugin runtimeyarn rebuildyarn removeyarn runyarn searchyarn set resolutionyarn set version from sourcesyarn set versionyarn stageyarn unplugyarn upyarn upgrade-interactiveyarn version applyyarn version checkyarn versionyarn whyyarn workspaceyarn workspaces focusyarn workspaces foreachyarn workspaces list

yarn plugin import

Download a plugin.

Usage

$> yarn plugin import <name>

Examples

Download and activate the "@yarnpkg/plugin-exec" plugin :

yarn plugin import @yarnpkg/plugin-exec

Download and activate the "@yarnpkg/plugin-exec" plugin (shorthand) :

yarn plugin import exec

Download and activate a community plugin :

yarn plugin import https://example.org/path/to/plugin.js

Activate a local plugin :

yarn plugin import ./path/to/plugin.js

Details

This command downloads the specified plugin from its remote location and updates the configuration to reference it in further CLI invocations.

Three types of plugin references are accepted:

  • If the plugin is stored within the Yarn repository, it can be referenced by name.

  • Third-party plugins can be referenced directly through their public urls.

  • Local plugins can be referenced by their path on the disk.

Plugins cannot be downloaded from the npm registry, and aren't allowed to have dependencies (they need to be bundled into a single file, possibly thanks to the @yarnpkg/builder package).