gulp-newer icon indicating copy to clipboard operation
gulp-newer copied to clipboard

When using gulp-requirejs, getting error "Expected a source file with stats"

Open Sawtaytoes opened this issue 8 years ago • 3 comments

When I am using gulp-requirejs as my src instead of gulp.src(), I get the error "Expected a source file with stats". Originally thought this is because the file didn't exist, but it looks like it might be something weird about how gulp-requirejs() puts files through the stream.

package.json

"gulp-requirejs": "^0.1.3",

gulpfile.js

rjs({
    baseUrl: baseDir,
    name: moduleMain,
    out: outputFile,
    paths: {'Scripts': 'empty:'},
    insertRequire: views,
    include: views,
    inlineText: true,
    excludeShallow: ['text']
})
.pipe(newer(baseDir + moduleMain + '/' + outputFile))
.pipe(gulp.dest(outputDir))

Sawtaytoes avatar Jan 13 '16 16:01 Sawtaytoes

The same issue happens when using Browserify:

gulp.task('buildJs', () => {
    return browserify({
        entries: `${SRC}/react/index.jsx`
    }).bundle()
        .pipe(newer(`${DEST}/bundle.js`))
        .pipe(vinylSource('bundle.js'))
        .pipe(gulp.dest(DEST));
});

If I remove .pipe(newer(`${DEST}/bundle.js`)) the Gulp task works as usual.

AntonioRedondo avatar May 15 '17 13:05 AntonioRedondo

OK, I just saw this: https://github.com/tschaub/gulp-newer/issues/42. For those who want to use newer with Browserify newer's author recommends to use Watchify instead.

AntonioRedondo avatar May 15 '17 15:05 AntonioRedondo

Guys for me the case ended with a different approach

install node latest version *install the updated node-sass (if you use it) install gulp-changed and discard gulp-newer for the moment

after doing these 3 steps I got my tasks working again

matteusbarbosa avatar Jul 02 '19 14:07 matteusbarbosa