title: Angular build watch for multiple libraries and and serve to another app
body: <p>I developing three helper <a href="https://angular.io/guide/creating-libraries" rel="nofollow noreferrer">angular libraries</a> that consumed by another main application. The ideal is having live rebuild for the libaries while my main app import those libraies and run at the same time so I can have live reload for my main app during development process of the libraries.</p>
  <p>I found  <code>ng build --watch</code> and I use it mutiple times with <code>run-s</code> for each of my libary then <code>npm link</code> the built folder then <code>npm link my-libary</code> in my main app.</p>
  <p>But the problem is when a libary is rebuilt, It first erase the linked files in dist folder (which linked by npm locally) and my main app start yelling compiler error and stop.</p>
  <p>The expectation is when I modify a library and save, It will be rebuilt and my angular app will consume the newly rebuilt library without yelling errors. How can I achieve this</p>
  <p>My script is:</p>
  <pre><code>...
  &quot;scripts&quot;: {
      &quot;ng&quot;: &quot;ng&quot;,
      &quot;prestart&quot;: &quot;run-s \&quot;ng build Lib-1 --prod --watch\&quot; \&quot;ng build Lib-2 --prod --watch\&quot; \&quot;ng build Lib-3 --prod --watch\&quot; &quot;
      &quot;start&quot;: &quot;node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng serve&quot;
   ...
  }
  ...   
  </code></pre>