Closed theoinglis closed 5 years ago
hey @theoinglis ,
would you like to describe" looking at the user agent and allowing that to make a good prediction of max widths " how do you see this?
Hi @dzmitry-stramavus, thanks for following up.
I use a package called mobile-detect to predict the device size and then use that to define max widths the image is likely to be. However, adding this would mean that you would need a user to pass in the user agent which I don't think you would want to do. As an optional parameter it might be useful though?
Anyway, I think the key task to achieve is simply making it SSR friendly by removing references to window, etc.
Backing up @theoinglis 's request here.
Using Next.js and server-side rendering, I've had to add this module https://github.com/martpie/next-transpile-modules as your library is not transpiled to es5 and imports were failing when building my project. Also, I've had to create wrappers around CloudimageProvider, Img, BackgroundImg to render them on clients only.
Could you work on a more SSR-friendly version please?
yep, I will work on it in the next release
Hi @dzmitry-stramavus. Has there been any progress on this?
@theoinglis , hey, our team was on vacation. We will try to find time during the week on it.
hey, how is it going with making library SSR friendly? wanted to use it in our project but the SSR incompatibility makes us sad :(
done in 1.6.5 version
I have had to workaround this for now, but I would recommend looking at the user agent and allowing that to make a good prediction of max widths that can be updated when the image is rendered in the frontend