问题
Is it possible to run a script on change using nodemon?
Is it possible to do something like this: nodemon --watch src --exec yarn run my-script
?
So, ideally I'd like to run a script only when there're changes in a src
folder
回答1:
As indicated in the Nodemon docs you can add a restart event command in nodemon.json
:
{
"events": {
"restart": "yarn my-script"
}
}
回答2:
Just put quotes around your script that you want to execute
nodemon --watch src --exec "yarn run my-script"
来源:https://stackoverflow.com/questions/51225277/run-script-on-change-in-nodemon