How can I run multiple npm scripts in parallel?

后端 未结 22 2129
灰色年华
灰色年华 2020-11-22 05:48

In my package.json I have these two scripts:

  \"scripts\": {
    \"start-watch\": \"nodemon run-babel index.js\",
    \"wp-server\": \"webpack-         


        
22条回答
  •  情深已故
    2020-11-22 06:14

    I have been using npm-run-all for some time, but I never got along with it, because the output of the command in watch mode doesn't work well together. For example, if I start create-react-app and jest in watch mode, I will only be able to see the output from the last command I ran. So most of the time, I was running all my commands manually...

    This is why, I implement my own lib, run-screen. It still very young project (from yesterday :p ) but it might be worth to look at it, in your case it would be:

    run-screen "npm run start-watch" "npm run wp-server"
    

    Then you press the numeric key 1 to see the output of wp-server and press 0 to see the output of start-watch.

提交回复
热议问题