Gulp 4 seems to not finish task in gulp.series
See original GitHub issueHey,
first let me say that I really love what you are doing with gulp and also gulp 4. While I sadly don’t know enough about low level js to help with the release, I figured I switch a project over to gulp 4 to at least do some testing. However I ran into a problem, I am not sure if this is something with gulp or an issue on my side (probably). I did not find any solution to this issue in any other ticket, so maybe you can help me.
This is my code:
gulp.task('build-js', function (done) {
Object.keys(filesJS).forEach(function (key) {
gulp.src(filesJS[key])
.pipe(sourcemaps.init())
.pipe(babel({
presets: [ [ 'es2015', { modules: false } ] ],
plugins: ['transform-custom-element-classes']
}))
.on('error', swallowError)
.pipe(concat(key + '.js'))
.pipe(uglify())
.pipe(sourcemaps.write('/'))
.pipe(gulp.dest('public/js'))
.on('end', function () {
reportSavings(sizes, 'JS (' + key + '):')
})
})
done()
})
gulp.task('js', gulp.series(
'clean-js',
function moveJsFiles () {
return gulp.src(moveFilesJS).pipe(gulp.dest('public/js'))
},
'build-js',
'rev-js',
// do more stuff
done();
}
)
)
The error I get is the following:
Error: File not found with singular glob: /Users/lukasoppermann/Code/veare/public/js/common.js
common.js
is created within build-js
.
When I run the tasks separately via the cli it works fine. It also works fine if I move build-js
above the moveJsFiles
function in the series.
I do not understand what I am doing wrong and why it only works this way. Please let me know how I can fix this.
Thank you.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
@lukasoppermann you can also do it using underscore’s
_.after
:Hey @phated I did indeed, my solution did not answer the stackOverflow question at all, and I think the answer is, that you will always have the wrapper function show up. So I see no sense in answering it with an answer that does not actually answer it. 😉
I solved it by keeping the
Object.keys(filesJS).forEach(function (key) {
but merging the streams to a variable define outside the forEach, which I can than return. Basically what you suggested above. So thanks.