重要提示: 此中文文档针对的是 Yarn 的最新版本。
有关 1.x 版本的中文文档,请点击进入 classic.yarnpkg.cn。
Yarn

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

Options

Definition
Description

--checksum

Whether to care if this plugin is modified

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.

If the --no-checksum option is set, Yarn will no longer care if the plugin is modified.

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).