Niels-IO / next-image-export-optimizer

Use Next.js advanced <Image/> component with the static export functionality. Optimizes all static images in an additional step after the Next.js static export.
MIT License
462 stars 56 forks source link

More error tolerant attempt to save /fetch remote image #231

Open PhilGale92 opened 3 months ago

PhilGale92 commented 3 months ago

Heya! one more quick potential change from me to gather thoughts.

Im using this tool to use SSG by conecting to contentful and downloading all the remote images. Now sometimes contentful fails to provide the image. Would it be possible to add a mode to downloadImagesInBatches in which the Unable to save ${formattedFilename} (empty file). error (and maybe other errors). Resolve() out rather than rejection.

Just as otherwise i'd have to query every image first / it seems a shame for the whole process to die out because of one image-download failure.

Hope the above makes sense, again if you okay it im happy to give it a go to make the change. Thanks,

Niels-IO commented 2 weeks ago

Would a retry mechanism help to mitigate the issue? I would like to still fail the process if one remote image does not load. (People running this in CI would complain otherwise)

PhilGale92 commented 1 week ago

Yeah that might just work! - I'll chuck your PR on our preprod site CI where i can reliably hit the issue when I get a chance and will try to get back to you hopefully in a week or so.