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.
413 stars 51 forks source link

process.env.nextImageExportOptimizer_storePicturesInWEBP assumed to be boolean #186

Closed andersekdahl closed 7 months ago

andersekdahl commented 7 months ago

On this line: https://github.com/Niels-IO/next-image-export-optimizer/blob/master/example/src/ExportedImage.tsx#L32

The variable process.env.nextImageExportOptimizer_storePicturesInWEBP is assumed to be a boolean but it's a string. I believe that should be changed to:

const useWebp = process.env.nextImageExportOptimizer_storePicturesInWEBP === 'true';
// Or
const useWebp = process.env.nextImageExportOptimizer_storePicturesInWEBP !== 'false';

Currently it doesn't seem possible to turn off the default webp format.

Niels-IO commented 7 months ago

Hi @andersekdahl,

Thanks for the report. That is a quite hefty bug. Glad you found it!

I created tests that should cover that case for the future.