簡體   English   中英

並行運行兩個 gulp.watch 任務

[英]Running two gulp.watch tasks in parallel

我一直無法將兩個單獨的 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% 確定為什么另一種方法不起作用。 歡迎任何幫助我理解的反饋。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM