Nodemon - ignore file and path
I am using node js and nodemon module.
Problem: If I change the file in the frontend, the server will automatically restart.
Expected: If I change multiple js or multiple files inside the path, it shouldn't restart the server.
I've tried the following code:
nodemon --ignore 'public / javascripts / template_files / *. js'
But the above code doesn't work. If I change any js files in the template_files folders it means restarting the server over and over again.
source to share
Based on the comments, I now have enough information to explain what's going on.
In yours, package.json
your start script should look like this:
"scripts" : {
"start" : "nodemon ./bin/www --ignore 'public/javascripts/template_files/*.js'"
},
This means that on startup npm start
, the command should be executed nodemon
(monitor all file changes), execute the file ./bin/www
, but not control those specific JS files. If the file (other than ignored files) changes, re-execute the file ./bin/www
.
What you did before was trying to execute nodemon --ignore 'public/javascripts/template_files/*.js'
from the command line, which will not run any particular file (IIRC), and will also leave the start script like nodemon ./bin/www
that, which will not ignore the files you want to ignore.
Make changes to package.json
and use npm start
. Don't type nodemon
directly at the command line, no need.
source to share