Did you forget to signal async completion?

Gulp from version 4 onwards consider all tasks to be automatically asynchronous and synchronous tasks are no longer supported by it. This error simply state that you have to explicitly signify when a task is completed. 

gulp.task('default', function () {
    gulp.src('ts/config.ts')
        .pipe(ts({
            noImplicitAny: true,
            outFile: 'output.js'
        }))
        .pipe(gulp.dest('dist/js'));
});//Throwing error Did you forget to signal async completion?
// append return within in the function
gulp.task('default', function () {
    return gulp.src('ts/config.ts')
        .pipe(ts({
            noImplicitAny: true,
            outFile: 'output.js'
        }))
        .pipe(gulp.dest('dist/js'));
});

Asynchronous approach executes the task parallelly (so highly productive unlike synchronous which execute function in series)but it also needed some way which acknowledge that task is completed. So, to resolve it if you are using stream within the function then return the task or pass callback function within the task to signify task is finished.

//Callback function done
gulp.task('show', function(done) {
  console.log("This is the callback testing.");
  done();
});

Leave a Reply

Your email address will not be published. Required fields are marked *