简体   繁体   中英

Use forked open-source project in react

So I'm needing to fork from "react-d3-graph" in order to implement and correct some features for a project I'm working on, ie zoom and highlightDegree, and implement it into my react project.

I've got the project forked into my personal GitHub, I'm just unsure on how I'd implement my version instead of the original in my React project.

You need to update your package.json to point to your forked github repo instead of the version number of react-d3-graph. Replace:

  "react-d3-graph": "x.y.z"

with

  "react-d3-graph": "your_github_username/react-d3-graph"

Then run npm install .

From then on, it will use your version rather than the original.

PS: note that npm's support for github dependencies is far from perfect. I still run into some issues with it every once in a while. Obviously, you will also need to re-run npm install any time you make changes to the repo. But that said, it works.

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