跳到主内容
版本:Next

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>
注意

如果你想更改包的依赖项,请不要使用修补来修改包的 package.json 文件。 For overriding dependencies, use overrides or a package hook.

配置项

--edit-dir <dir>

需要修补的软件包将被解压到此目录。

--ignore-existing

修补时忽略现有的修补文件。