Skip to content

Commit 0e3f79a

Browse files
committed
return imagemin promise in clonedPipeline handler
fixes: Bluebird Warning: a promise was created in a handler but was not returned from it
1 parent 56b88fe commit 0e3f79a

File tree

1 file changed

+4
-8
lines changed
  • packages/gatsby-plugin-sharp/src

1 file changed

+4
-8
lines changed

packages/gatsby-plugin-sharp/src/index.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ const processFile = (file, jobs, cb, reporter) => {
160160
) {
161161
clonedPipeline
162162
.toBuffer()
163-
.then(sharpBuffer => {
164-
imagemin
163+
.then(sharpBuffer => imagemin
165164
.buffer(sharpBuffer, {
166165
plugins: [
167166
imageminPngquant({
@@ -175,8 +174,7 @@ const processFile = (file, jobs, cb, reporter) => {
175174
.then(imageminBuffer => {
176175
fs.writeFile(job.outputPath, imageminBuffer, onFinish)
177176
})
178-
.catch(onFinish)
179-
})
177+
.catch(onFinish))
180178
.catch(onFinish)
181179
// Compress webp
182180
} else if (
@@ -185,16 +183,14 @@ const processFile = (file, jobs, cb, reporter) => {
185183
) {
186184
clonedPipeline
187185
.toBuffer()
188-
.then(sharpBuffer => {
189-
imagemin
186+
.then(sharpBuffer => imagemin
190187
.buffer(sharpBuffer, {
191188
plugins: [imageminWebp({ quality: args.quality })],
192189
})
193190
.then(imageminBuffer => {
194191
fs.writeFile(job.outputPath, imageminBuffer, onFinish)
195192
})
196-
.catch(onFinish)
197-
})
193+
.catch(onFinish))
198194
.catch(onFinish)
199195
// any other format (jpeg, tiff) - don't compress it just handle output
200196
} else {

0 commit comments

Comments
 (0)