Watch task in Gulp 4 gets slower every time it runs
See original GitHub issueWhat were you expecting to happen?
If I run gulp watch
with the following gulpfile and edit test.html
by adding and removing whitespace, the “styles” task should take a similar amount of time every time the watcher fires
What actually happened? Task takes longer every time it is run
Gulpfile
let gulp = require('gulp');
let rename = require('gulp-rename');
function styles() {
return gulp.src('src/**/*.scss')
//Issue happens with or without this rename plugin
.pipe(rename({extname: '.test'}))
//Issue only happens if destination directory is same as source directory
.pipe(gulp.dest('src'));
}
gulp.task('watch', function() {
//only happens if there is a glob here
gulp.watch('src/**/test.html', styles);
});
What version of gulp are you using? CLI version 1.2.2 Local version 4.0.0-alpha.2
What versions of npm and node are you using? node: v7.2.0 npm: 3.10.9 OS: Windows 10
Zipped version of an app that reproduces the issue gulp-issue.zip
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Gulp tasks running slow - Stack Overflow
I'm getting poor performance from my gulp build. Node v0.10.29 Windows 8.1 x64. Gulpfile: // based off: https://github.com/kriasoft/SPA-Seed ...
Read more >Gulp watch task is slow because it builds all CSS files - Drupal
Gulp watch task is slow because it builds all CSS files ; Reviewed & tested by the community ; Project: Zen ; Version:...
Read more >Bad old Gulp getting extremely slow : r/Frontend - Reddit
Can't you run a watch gulp task that only compiles the elements you're working on instead of running your entire build every time...
Read more >Gulp compile is this normal speed or unusually slow?
When you run gulp for the first time it's slow. Subsequent calls are a lot faster and gulp watch is faster yet.
Read more >parallel() - gulp.js
Don't rely on this fix for very long. Avoid duplicating tasks#. When a composed operation is run, each task will be executed every...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I tried adding
{usePolling: true}
togulp.watch()
and that “fixed” the issue. Not sure if that helps narrow it down.It is the recursive ** that causes this.
gulp.watch('src/*.html', styles);
should fix it.