Npm script problem

requirements:
1, the gulp command generates the dist folder, performs the watch operation
2, and then executes nodemon, to restart node server once the dist generated by gulp changes

"scripts": {
    "server": "gulp && nodemon ./dist/app.js"
  }

problem: after
1 and gulp watch, the following nodemon commands will not be executed
2. If the operation is changed to parallel operation, gulp & nodemon. / dist/app.js, will report an error when starting server for the first time because there is no dist directory at the beginning.

is there a good solution to this requirement?

Mar.01,2021

you should write nodemon in the gulp watch callback

Menu