I have the following:
nodemon server/server.js --watch common --watch serve
This doesn't work at all. Alright, maybe it's because server/server.js
doesn't exist! So I tried the following:
nodemon index.js --watch common --watch serve
Still it didn't work. I also changed common
with src
. That didn't work either. Please help me with this.
Install package tsc-watch
if you don't have it installed yet: npm install -D tsc-watch
You can add this line under your "scripts"
tag in package.json
:
"start:watch": "tsc-watch --target es2017 --outDir ./dist --onSuccess \"node .\"",
And use npm run start:watch
instead of npm run start
.
It helps automatically detect any source-code changes and restart the server as well.
Reference: https://github.com/strongloop/loopback-next/issues/2242#issuecomment-476866232