

We can provide & for running in parallel and & for running in series. Using the built-in OS shell capabilities Because npm scripts are spawning a shell process under the hood, we can use its syntax to achieve what we need.

You can use an asterisk( *) as a wildcard. Running npm run build will run the prebuild command first and upon completion, will run postbuild. The colon( :) in the script is equivalent to npm run. The dev script uses the concurrently module to run all the watch scripts. "watch:css": "sass -watch styles/main.scss:public/css/main.css",Īs you can see in the code above I have two package.json scripts, watch:css & watch:js, that watch all changes for SASS code and TypeScript. And will use concurrently do run them in parallel. Let’s do a couple watch scripts for SASS/CSS and TypeScript. Step 2: Create your package.json dev scripts
#Npm run parallel install#
The first step is to install concurrently into your project, and save it as a dev dependency in your package.json file. Step 1: Install the concurrently NPM module Let’s do a step-by-step process to get you running commands in parallel. Concurrently allowed me to run multiple commands in parallel! I then found a NPM module called Concurrently. That got really annoying and asked myself, “How can I run these scripts in parallel?”

For a while I was running multiple NPM scripts by opening multiple terminal tabs.
