snippetjavascriptCritical
How can I run multiple npm scripts in parallel?
Viewed 0 times
parallelrunhownpmmultiplecanscripts
Problem
In my
I have to run these 2 scripts in parallel everytime I start developing in Node.js. The first thing I thought of was adding a third script like this:
... but that will wait for
How can I run these in parallel? Please keep in mind that I need to see the
package.json I have these two scripts:"scripts": {
"start-watch": "nodemon run-babel index.js",
"wp-server": "webpack-dev-server",
}I have to run these 2 scripts in parallel everytime I start developing in Node.js. The first thing I thought of was adding a third script like this:
"dev": "npm run start-watch && npm run wp-server"... but that will wait for
start-watch to finish before running wp-server.How can I run these in parallel? Please keep in mind that I need to see the
output of these commands. Also, if your solution involves a build tool, I'd rather use gulp instead of grunt because I already use it in another project.Solution
Use a package called concurrently.
Then setup your
npm i concurrently --save-devThen setup your
npm run dev task as so:"dev": "concurrently --kill-others \"npm run start-watch\" \"npm run wp-server\""Code Snippets
npm i concurrently --save-dev"dev": "concurrently --kill-others \"npm run start-watch\" \"npm run wp-server\""Context
Stack Overflow Q#30950032, score: 1067
Revisions (0)
No revisions yet.