Gulp Imagemin "MaxBufferError: stdout maxBuffer exceeded" when I try to minify large amount of files

484 views Asked by At

Gulp Imagemin errors MaxBufferError: stdout maxBuffer exceeded when I try to minify a large amount of files (230). It will run the task if I minify 40-50 files at a time.

How do Increase the buffer? Or stop the task discontinuing?

node version 14.5, gulp version 4.0.2, gulp-imagemin version 7.1.0.

function imageMin(done) {
 // Locate unprocessed images
return gulp.src('./src/assets/images/*')
 // Optimise images and reduce file size, use gulp-cache to stop repeating
.pipe(cache(imagemin([
    imagemin.gifsicle({interlaced: true, optimizationLevel: 3,}), // 1 to 3
    imagemin.mozjpeg({quality: 90, progressive: true,}),
    imagemin.optipng({optimizationLevel: 5,}), // 0 to 7
    imagemin.svgo({
        plugins: [{cleanupIDs: false,}]
        })
    ],
    // Shows files optimastion results in the terminal
    {verbose: true } 
)))
// Send optimised images to folder
.pipe(gulp.dest('./dist/assets/images')),
done();
}
0

There are 0 answers