I am trying to make Nodemon run two different commands depending on which file changed. I tried using nodemon.json
and invoking it using nodemon nodemon.json
(because it didn't seem to be getting picked up just by nodemon
):
{
"watch": "nodemon.json,main.js,index.js",
"execMap": {
"main.js": "electron .",
"index.js": "echo todo",
"nodemon.json": "echo Nodemon config reloaded"
}
}
Nodemon doesn't pick up any changes with this setup. I think I might have a problem in the watch
glob. When I remove it (so it watches everything I think by default), then file changes are getting picked up, but Nodemon only ever executes node index.js
. I never speficied that anywhere so I assume that's the default and the execMap
is not being honored? Is it only for extensions?
I am not sure how to craft a config which takes these two different paths. Is it even possible with Nodemon?