How it works...
The command most interesting for us is the second one. When you run it, nodemon will start monitoring, meaning it will watch whatever directory you selected (out, in this case) and whenever it detects some file change, it will wait one second (to make sure, for example, that all files are saved) and then it will rerun the application. How did I do this?
Initially, I started nodemon. When you do npm run nodemon, the project is built and then run, and nodemon keeps waiting for any changes; see the following screenshot:
Afterwards, I just added a simple console.log() line, so a file would be changed; the following screenshot was the result, showing the rebuilt and restarted code, plus the extra output line:
That's all there is to it. The application will be rebuilt and restarted automatically, without us having to manually rerun npm start each and every time; a big help!