1

I have an Angular 4 application. I installed an external library using,

npm install some-library --save

I then had to made changes to that library to get it to work the way I needed it. This all works fine now.

My question is, How do I keep a local copy of this library in my project? Do I just remove it from node_modules? I don't want to loose my changes if I have to do a reinstall of the dependencies.

Thanks, Bill

Bill
  • 13
  • 3
  • If you want to use it as a dependency (and not copy the modified files to your project), you will have to publish it somewhere as a new dependency. – acdcjunior Jun 16 '17 at 20:58
  • Just wondering how did you get external library working in your angular applicaition? I'm struggling to make it happen. Here is my question, Can you probably post your way of using library [here](https://stackoverflow.com/questions/49714435/using-pipedrive-node-module-in-angular-application) so that I can also solve it ? – Sangeeta Apr 09 '18 at 05:51

1 Answers1

2

The issue seems to me that you need a slightly custom version of an available npm package. The way I would handle this would be to find the original package on GitHub and fork it. Make all the modifications you need to the forked repo (the same changes you made to your local copy) and push those up.

Now that you have that package up on GitHub you can actually install that repo as a dependency! You would just need to run the following command...

npm install --save <githubname>/<reponame>

With that you should be all set. You have your custom version on GitHub, and anytime you run the npm install command it'll grab your copy of that package from GitHub.

MichaelSolati
  • 2,847
  • 1
  • 17
  • 29