0

I have an Angular 10 project that is using an open source Angular component that was installed using the normal "npm install --s xxxxxxx" route.

I want to clone the open source Angular component github project to my local PC to make some code improvements.

How do I make my Angular project point at the cloned local version of the open source component?

user2868835
  • 1,250
  • 3
  • 19
  • 33

2 Answers2

0

You have two options:

  1. Either you remove your xxxxxxx dependency from your package.json, reinstall packages, and then place your downloaded library under a shared components/directives folder in the application. Finally, change your imports (where you use that dependency in your components / modules) so that they point on your local exported dependency classes.

  2. Or you publish your changed library to the npm registry / github account and then refactor your package.json dependency's part so it'd be fetched from your published dependency's resource.

This question's answers could help you in the 2nd case: How to install an npm package from GitHub directly?


Side note: These two options avoid portability issues for your application, i.e. since they permit the dependency to be shipped with your app and it would be executed as it should be on other developer's sides (which is not possible with some other solutions)

SeleM
  • 9,310
  • 5
  • 32
  • 51
0

You can use the file: prefix in your package.json.

You can find more examples of how to use it here

{
    "name": "myProject",
    "version": "1.0.0",
    "private": true,
    "dependencies": {
        "my-component-library": "file:../../component-library/components"
    }
Marco
  • 1,073
  • 9
  • 22