1

Just attempting to move from grunt to gulp and learning as I go. One item which has had me scratching my head is the error "Did you forget to signal async completion?" when trying to run requirejs (js:rjs in the gulpfile below). My very basic gulpfile.js is:

'use strict';

var gulp = require('gulp');
var sass = require('gulp-sass');
var rjs = require('gulp-requirejs');

gulp.task('sass', function()
{
  return gulp.src('./*.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(gulp.dest('./'));
});

gulp.task('sass:watch', function()
{
    gulp.watch('./*.scss', gulp.series('sass'));
});

gulp.task('js:rjs', function()
{
    return rjs({
        baseUrl: "./script.js",
        out: "./script.rjs.js",
    })
    .pipe(gulp.dest('./'));
});

The answer at https://stackoverflow.com/a/36899424/1424591 seems pretty exhaustive but I want to know how I can identify which of these solutions is required here and why. I have tried the callback method

gulp.task('js:rjs', function(done)
{
    return rjs({
        baseUrl: "./script.js",
        out: "./script.rjs.js",
    })
    .pipe(gulp.dest('./'));
    done();
});

which results in the same issue.

Zakalwe
  • 863
  • 1
  • 7
  • 17

0 Answers0