Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define custom nodemon configuration in nodemonConfig in package.json?

I tried implementing custom nodemon configuration in package.json as shown below:

"nodemonConfig": {
    "watch": ["server", "bin/www"],
    "ext": "ts",
    "ignore": ["*.test.ts"],
    "delay": "3000",
    "execMap": {
      "ts": "ts-node"
    }
  }

Yet, it didn't work. Nodemon doesn't restart when ./bin/www is edited, nor does ignoring the files that restart the server works.

Can anyone suggest me the correct nodemonConfig?

like image 934
ankurnarkhede Avatar asked Oct 26 '25 07:10

ankurnarkhede


2 Answers

I think these settings only work when npm is starting nodemon, something like

// package.json
"scripts": {
  "start:dev": "DEBUG=app:* nodemon app.js"
}

then use

$> npm run start:dev

like image 183
William Vbl Avatar answered Oct 28 '25 22:10

William Vbl


package.json

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node index.js",
    "dev": "nodemon index.js"
  },

Terminal

npm run dev
like image 36
Soumitya Chauhan Avatar answered Oct 28 '25 22:10

Soumitya Chauhan



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!