Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop restarting node.js server when particular file changes

Tags:

node.js

Im using a package called "sp-pnp-node". Whenever Im running this file, new "private.json" file would create on the root folder.If I run this file again and again private.json file getting overwriting. So my node server got restarting everytime.

What i need is, is there any way to prevent restart node.js server when this file private.js getting save?.

like image 950
JeevaRekha Avatar asked Nov 26 '25 02:11

JeevaRekha


1 Answers

You need to add this config to your package.json, just add a directory or a file pattern to nodemonConfig in your package.json to ignore them. So, whenever there are any changes in the directory or file pattern that is ignored nodemon won't restart your server.

Sample package.json

{
    "name": "nodemon",
    "homepage": "http://nodemon.io",
    "...": "... other standard package.json values",
    "nodemonConfig": {
                        "ignore": ["*.json"]
                     }
}

take a look at the documentation for more information.

like image 188
AJS Avatar answered Nov 27 '25 18:11

AJS



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!