How to use npm link?

Issue

I have a module, let call it contact_us, that I have linked it to my ionic project. I could successfully link the module and see it in my app, but when I modify the contact_us module, the changes are not reflected in my project.

Here is what I’ve done:

  1. In the contact_us module:
 npm link
  1. In the project:
npm link contact_us
ionic cap build android

Does anyone know what I’m missing? Thanks in advance.

Solution

Well, I found how to update the link.
In your module directory, i.e., contact_us, do:

npm run build
cd /dist/contact_us
npm link
ng build --watch

Then in the you project directory:

npm link contact_us
ionic cap build android

Answered By – user6781

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published