我怎么能并行运行多个NPM脚本? [英] How can I run multiple NPM scripts in parallel?
问题描述
在我的的package.json
我有这两个脚本:
In my package.json
I have these two scripts:
"scripts": {
"start-watch": "nodemon run-babel index.js",
"wp-server": "webpack-dev-server",
}
我要并行每次运行这些脚本,2 我开始在Node.js的开发我想到的第一件事就是加入了第三个脚本是这样的:
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"
...,但将等待启动手表
WP-服务器
运行前完成。
如何可以并行运行这些?请记住,我要看看这些命令的输出
。另外,如果您的解决方案涉及构建工具,我宁愿使用一饮而尽
而不是咕噜
因为我已经用它在另一个项目。
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.
推荐答案
使用一个名为同时的。
NPM我同时--save-dev的
然后设置你的 NPM运行开发
的任务,因为这样:
Then setup your npm run dev
task as so:
"dev": "concurrently --kill-others 'npm run start-watch' 'npm run wp-server'"
这篇关于我怎么能并行运行多个NPM脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!