stkvtflw
stkvtflw

Reputation: 13587

How do i properly change npm dependency source code?

So, let's say i have a lodash dependency. I want to modify some method in it and have it installed with this modified code all the time when i'm using npm i command. I assume i should fork the dependency repo, change it and then somehow override installation path to the forked repo instead of npm package. Could someone explain me how to actually do that the-right-way?

Upvotes: 2

Views: 402

Answers (1)

Arun Ghosh
Arun Ghosh

Reputation: 7764

Going by what you have done now, you can fork lodash and create your version of lodash and register it with npm. The issue is you cannot get the updates of the lodash

Better method will be to override the function you want to change, and make sure it is called next after lodash is loaded.

Upvotes: 2

Related Questions