Gulp Watch and Nodemon conflict

前端 未结 2 1116
滥情空心
滥情空心 2021-02-01 23:18

Short of it: started using Gulp recently (convert from Grunt), and am trying to use both Gulp\'s default watch task (not gulp-watch from npm) for SASS/JS/HTML and gulp-nodemon (

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-02 00:01

    FWIW, it seems that using the cwd parameter on gulp-nodemon's configuration actually sets the entire gulp cwd to that directory. This means future tasks will be executed in the wrong directory.

    I had this problem when running gulp watch tasks on my frontend server at the same time as nodemon tasks on my backend server (in the same gulpfile), there was a race condition wherein if the nodemon command was executed first, the frontend stuff would actually build into (Home)/backend/frontend instead of (Home)/frontend, and everything would go pearshaped from there.

    I found that using watch and script params on gulp-nodemon worked around this (although it still looks like nodemon is watching my entire project for changes rather than the built backend directory).

提交回复
热议问题