When working locally on a NodeJS project, nodemon is required in order to make the coding easier. I frequently see the cases when it's installed as a dev-dependency only, so I wonder: what is the correct approach when it comes to deployment? Should we include it as a dev-dependency only, or should we include it into the server as well?
In this project I have, I see nodemon installed as regular dependency and then in the package.json configs:
"scripts": {
"start": "nodemon src/app.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
But I am thinking to install it as a dev-dependency only and then to rework the config like:
"scripts": {
"start-prod": "node src/app.js",
"start-dev": "nodemon src/app.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
So I wonder if this will be a correct approach? I don't see a reason why on the server I would watch the file changes with nodemon, so I wonder if I got it right? In case sometimes it is needed, what are the possible cases when that will be required?