So I have a really simple build file that stuck for no reason( Or I think it is for no reason )
What's been happening is, when I try gulp watch
it stucks forever. Like even if I change files(file1, file2, or any files that is being watched) it does not trigger anything.
✗ gulp --version
[09:13:09] CLI version 2.0.1
[09:13:09] Local version 4.0.0
const gulp = require('gulp');
const {watch, series} = gulp;
const webpack = require('webpack-stream');
gulp.task('task1', function() {
return gulp.src('src/file1.js')
.pipe(webpack({
output: {
filename: 'file1.map.js',
}
}))
.pipe(gulp.dest('dist'));
});
gulp.task('task2', function() {
return gulp.src('src/file2.js')
.pipe(webpack({
output: {
filename: 'file2.map.js',
}
}))
.pipe(gulp.dest('dist'));
});
gulp.task('copy-artifacts', function() {
gulp.src('dist/file1.js')
.pipe(gulp.dest('../build/scripts'))
});
gulp.task('watch', function (cb) {
watch(['utility/*.js', 'src/*.js'], {}, series('task1', 'task2', 'copy-artifacts'));
});
add the return and then it will be able to complete
gulp.task('copy-artifacts', function() {
return gulp.src('dist/file1.js')
.pipe(gulp.dest('../build/scripts'));
});