javascript - 并行运行两个 gulp.watch 任务
问题描述
我在运行两个单独的 gulp 手表作为我的默认任务时遇到了麻烦。这是我的 gulpfile.babel.js
import gulp from "gulp";
import git from "gulp-git";
import ts from "gulp-typescript";
const tsProject = ts.createProject("tsconfig.json");
export function watchTs() {
gulp.watch(
// details omitted...
);
}
export function watchGit() {
gulp.watch(
// details omitted...
);
}
export default function(cb) {
gulp.parallel(watchTs, watchGit);
}
这就是我运行 gulp 时发生的情况:
master* $ gulp [16:21:52]
[16:21:54] Requiring external module @babel/register
[16:21:55] Using gulpfile ~/Documents/github/screeps/gulpfile.babel.js
[16:21:55] Starting 'default'...
[16:21:55] The following tasks did not complete: default
[16:21:55] Did you forget to signal async completion?
我可以通过运行得到正确的结果:gulp watchTs & gulp watchGit
。为什么这不起作用?
解决方案
我想到了。我认为默认值需要是我定义的函数,但这有效。
export default gulp.parallel(watchTs, watchGit);
我仍然不能 100% 确定为什么其他方法不起作用。欢迎任何有助于我理解的反馈。
推荐阅读
- c++ - 查找最长的公共子串
- java - 如何通过 RestController 代理内部 mjpeg 端点
- apache-spark - 为什么 DROP TABLE 忽略子句 IF EXISTS?
- java - 如何在小数点后四舍五入到最接近的 5
- java - `commitNow()` 和 `postDelayed` 如何使这段代码工作?
- javascript - GulpUglifyError:无法缩小 JavaScript - 排序映射
- python - 如何将键和值(列表)附加到新字典?
- amazon-web-services - 使用 AWS ALB 让子域指向不同的目标组
- python - 如何从 Python 列表的末尾删除“无”项
- python - 这个矩阵或表格的名称是什么?