gulp.series doesn't serialize task

593 Views Asked by At

I'm using gulp 4 with Node 8 and the following setting

gulp.task('task1', function(done) {
  gulp.src(...)
      .pipe(debug({title: 'TASK1'})
      .pipe(...)
  done();
});

gulp.task('task2', function(done) {
  gulp.src(...)
      .pipe(debug({title: 'TASK2'})
      .pipe(...)
  done();
});

gulp.task('task3', function(done) {
  gulp.src(...)
      .pipe(debug({title: 'TASK3'})
      .pipe(...)
  done();
});

gulp.task('default', gulp.series(gulp.parallel('task1', 'task2'), 'task3'));

This is what I see when the task runs--they all run parallely

[23:41:57] TASK1 src/ [23:41:57] TASK1 src/ [23:41:57] TASK1 src/ [23:41:57] TASK1 src/ [23:41:58] TASK3 src/ [23:41:59] TASK2 src/ [23:41:59] TASK2 src/ [23:41:59] TASK2 src/ [23:41:59] TASK1 src/ [23:41:59] TASK1 src/ [23:41:59] TASK3 src/ [23:41:59] TASK3 src/ [23:41:59] TASK1 src/ [23:41:59] TASK1 src/ [23:41:59] TASK1 src/ [23:42:00] TASK1 src/ [23:42:00] TASK3 src/ [23:42:00] TASK2 src/ [23:42:00] TASK2 src/ [23:42:00] TASK2 src/ [23:42:00] TASK2 src/ [23:42:00] TASK3 src/ [23:42:00] TASK3 src/ [23:42:00] TASK3 src/ [23:42:00] TASK1 src/

Anyone experienced the same issue? Is there a fix for this?

Thanks,

1

There are 1 best solutions below

1
On

The problem was that I didn't signal async completion properly. With gulp 4, I don't need to use callback in the task function. Instead I should just use return.