如何解决如何在构建反应之前添加自定义脚本?
我使用的 Chart 库有错误,为了解决这个问题,我应该运行这个脚本:https://github.com/plouc/nivo/blob/master/scripts/patch-react-spring.js。在构建之前。我想过在package.json下的根目录添加“prebuild”:“npm run patch-react-spring.js”并添加patch-react-spring.js文件。但是,当我执行 npm run patch-react-app 或 npm run prebuild 时,我收到错误:npm ERR!缺少脚本:patch-react-spring.js
这是该项目的 GitHub 存储库:https://github.com/JonasHendel/SunPosition
解决方法
你可以尝试使用这个库
https://www.npmjs.com/package/patch-package
# fix a bug in one of your dependencies
vim node_modules/some-package/brokenFile.js
# run patch-package to create a .patch file
npx patch-package some-package
# commit the patch file to share the fix with your team
git add patches/some-package+3.14.15.patch
git commit -m "fix brokenFile.js in some-package"
在 package.json 中
"scripts": {
"postinstall": "patch-package"
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。