next-optimized-images icon indicating copy to clipboard operation
next-optimized-images copied to clipboard

TypeError in Canary Img component

Open bezoerb opened this issue 4 years ago • 3 comments

First of all, thanks for this module. I'm currently playing around with the Canary version and the corresponding react-optimized-image module.

<Img src={require(`publicImages/logo.png`)} webp sizes={[400, 800]} />

Throws an Error:

TypeError: Cannot read property 'fallback' of undefined
    at findFallbackImage (.../node_modules/react-optimized-image/lib/components/Img.js:71:14)

I already tried to debug but without the sources being public available this is a little challenging :) What about making the dependencies of the canary version public:

  • https://github.com/cyrilwanner/next-optimized-images
  • https://github.com/cyrilwanner/optimized-images-loader
  • ...

Thanks :)

bezoerb avatar Jun 30 '20 05:06 bezoerb

@bezoerb You probably forgot the babelrc settings.

brandonpittman avatar Jul 05 '20 06:07 brandonpittman

I published a new canary version today which should recognize more use-cases (also styled-components) so I suggest trying that out. A missing babelrc setting could also lead to this error.

Those repositories were lacking documentation so that's why I kept them private. But that has now been resolved and all dependencies are now public.

cyrilwanner avatar Jul 22 '20 12:07 cyrilwanner

Thanks @cyrilwanner i'm currently working on another project but i'll try the changes as soon as i get back to it :)

bezoerb avatar Jul 22 '20 22:07 bezoerb