Replies: 3 comments 2 replies
-
Quick nit: I think it would need to be |
Beta Was this translation helpful? Give feedback.
-
As we were discussing in chat earlier, one thing to keep in mind is that this approach only works for images that we know about at build time. Doing something like this at serve time would be a big performance anti-pattern and counteract a lot of the performance features built into the image component. |
Beta Was this translation helpful? Give feedback.
-
Would you expect |
Beta Was this translation helpful? Give feedback.
-
Overview
The new
import image from "../some-image.jpg";
method introduced in Next.js 11 works great, but has some caveats:blurDataURL
for remote images (static or dynamic)getImageProps
aims to resolve this.The API is similar to that of – my own project –
plaiceholder
, returning the image props for later use on theImage
component.This could be used for static images anywhere in a file, and dynamic images (e.g. when sourced from a content API) inside
getStaticProps
Example
Further Resources
Additional Context
cc @atcastle @styfle @lachlanjc (continuing our private chat publicly)
Beta Was this translation helpful? Give feedback.
All reactions