4

MaxBufferError: stdout maxBuffer exceeded当我尝试缩小大量文件 (230) 时,Gulp Imagemin 错误。如果我一次缩小 40-50 个文件,它将运行任务。

如何增加缓冲区?还是停止任务中止?

节点版本 14.5,gulp 版本 4.0.2,gulp-imagemin 版本 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();
}
4

0 回答 0