I developing three helper angular libraries 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.
I found ng build --watch
and I use it mutiple times with run-s
for each of my libary then npm link
the built folder then npm link my-libary
in my main app.
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.
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
My script is:
...
"scripts": {
"ng": "ng",
"prestart": "run-s \"ng build Lib-1 --prod --watch\" \"ng build Lib-2 --prod --watch\" \"ng build Lib-3 --prod --watch\" "
"start": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng serve"
...
}
...