修改node_module中的包,不受重新安装的影响(patch-package,还能将修改同步到团队成员中)
修改别人的源码往往有这几个方式:
1.直接在项目的node_modules下找到插件的源码直接修改;
优点:简单直接、快速见效
缺点:不能持久化,一旦重新安装就失效;不方便团队成员使用修改后的代码
2.去github上fork代码到自己的仓库进行修改,并将自己修改过后的代码发布到npm上使用;
优点:团队成员都可以使用到这份修改的代码
缺点:麻烦
patch-package官方介绍
patch-package lets app authors instantly make and keep fixes to npm dependencies. It's a vital band-aid for those of us living on the bleeding edge.
Patches created by patch-package are automatically and gracefully applied when you use npm(>&#