Image shortcode error with “jpg” file extensions
tedw opened this issue · 1 comments
tedw commented
FYI, after updating @11ty/eleventy-img
to 0.8.0 I was getting this error:
TypeError: Cannot read property 'reverse' of undefined
eleventy-webpack/utils/shortcodes.js
Line 86 in 2b0242d
After reading through the changes, it turned out to be related to this fix 11ty/eleventy-img#64 (comment).
Regardless of whether the source image uses the jpg
or jpeg
extension, the returned object will use the jpeg
key.
Here’s how I fixed it in my project:
let extension = path.extname(src).slice(1).toLowerCase();
// Normalize “jpg” extension to match what @11ty/eleventy-img does
extension = extension == 'jpg' ? 'jpeg' : extension;
clenemt commented
Thanks, will have a look !