Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/479.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 并行运行两个gulp.watch任务_Javascript_Node.js_Git_Typescript_Gulp - Fatal编程技术网

Javascript 并行运行两个gulp.watch任务

Javascript 并行运行两个gulp.watch任务,javascript,node.js,git,typescript,gulp,Javascript,Node.js,Git,Typescript,Gulp,我的默认任务是运行两个单独的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

我的默认任务是运行两个单独的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);
}
这就是我大口大口喝的时候发生的事情:

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?
我可以通过运行以下命令获得正确的结果:
gulpwatchts&gulpwatchgit

为什么这不起作用?

我想出来了。我认为默认值应该是我定义的一个函数,但这是可行的

export default gulp.parallel(watchTs, watchGit);

但我仍然不能100%确定为什么另一种方法不起作用。欢迎任何有助于我理解的反馈。

如果在
并行
行之后调用
cb()
函数,可能会起作用。