Javascript 并行运行两个gulp.watch任务
我的默认任务是运行两个单独的gulp手表,但一直存在问题。这是我的gulpfile.babel.jsJavascript 并行运行两个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
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()
函数,可能会起作用。