跳到主内容
版本:9.x

pnpm patch <pkg>

给软件包添加补丁(灵感来自于 Yarn 中一个类似的命令)。

该命令会将指定的软件包提取到一个可以随意编辑的临时目录中。

Once you're done with your changes, run pnpm patch-commit <path> (with <path> being the temporary directory you received) to generate a patchfile and register it into your top-level manifest via the patchedDependencies field.

使用方法:

pnpm patch <pkg name>@<version>
注意

If you want to change the dependencies of a package, don't use patching to modify the package.json file of the package. For overriding dependencies, use overrides or a package hook.

配置项

--edit-dir &lt;dir>

需要打补丁的包会被解压到这个目录下。

--ignore-existing

打补丁时忽略已有的补丁文件。