简体   繁体   中英

How to patch a dependency of a npm library?

I experienced a bug in a deep dependency of a library installed using the npm. I fixed that bug in a fork and created a pull request on github.

I'm wondering how to share my fix with my co-workers. I found this article but since it's not my dependency but a dependency of a library I use I don't know how to solve this problem.

Even if my pull-request get's accepted fast, I need to wait for the maintainer of the library to update his dependencies, what may never even happen.

Is there any common way how to solve such a thing?

此库似乎针对此问题: https : //www.npmjs.com/package/patch-package

If the license of the original library allows you to take and modify it as you wish, you could clone it and submit your own NPM module (a relatively easy process) with the properly fixed submodule. Or just check that into your company's repository and don't include it on your package.json as a dep (to prevent it from overwriting it with npm install).

或者您可以创建一个补丁并在“安装后”阶段应用它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM