使用patch-package修改node_modules中的第三方包中的问题

创建日期:2024-06-21 21:29:17
更新日期:2024-12-27 19:44:24

修改node_modules中的包做成补丁保存在项目中。

1、安装patch-package包。

npm install patch-package -D

2、添加postinstall脚本。

编辑package.json,在scripts中添加脚本。

"scripts": {
    "postinstall": "patch-package"
}

3、修改node_modules中的包。

修改@terraformer/arcgis。

4、将修改后的包做成补丁。

npx patch-package @terraformer/arcgis

5、其他用户应用补丁。

npm install