15

When we use nodemon, for example, we can manually trigger a rebuild by typing rs to stdin and hitting return/enter.

I am wondering if there is a way to manually trigger a rebuild when using ng build --watch or ng serve. On occasion, these fail to pick up files, or fail during a bigger refactor. Instead of using ctrl-c, I am wondering if there is a way to type something into stdin.

2 Answers2

6

You just need to club them

nodemon ng build --watch

And it works in both cases, changes as well as rs manual restart

Nodemon

Tarun Lalwani
  • 142,312
  • 9
  • 204
  • 265
  • but I guess you need to configure nodemon to not watch any files, only listen for stdin? –  Apr 25 '18 at 19:29
  • I suppose nodemon could watch some files that `ng serve` / `ng build` doesn't, and then you could really tag-team. For example, nodemon could watch `.angular-cli.json`, that would be radical. –  Apr 25 '18 at 19:30
  • In my test it works without a problem, give it a shot – Tarun Lalwani Apr 25 '18 at 19:31
  • 1
    also note this will not allow for incremental builds, and that's the problem :( –  Apr 25 '18 at 19:31
  • I was hoping that `rs` would restart an incremental build, not kill the process and start a new one –  Apr 25 '18 at 19:31
  • Yep, works nice but is very slow compared to simple `ng serve --watch true`. Restarts all the application, thus not suitable for Angular apps. – user1278890 Jun 16 '20 at 16:33
0

Just add a space in a .ts file and save it. Adding a space to a .html file doesnt work

Markus
  • 1,020
  • 14
  • 18