getImageProps not a function?
Answered
Berger Picard posted this in #help-forum
Berger PicardOP
Hi, I'm following the guide [here](https://nextjs.org/docs/app/api-reference/components/image#art-direction) to build an image component that lets me set multiple sources for my images to handle some responsive layout stuff but running into an issue.
Basically, I'm getting the following error, and I can't figure out what's triggering it.
my code:
Basically, I'm getting the following error, and I can't figure out what's triggering it.
⨯ TypeError: (0 , next_image__WEBPACK_IMPORTED_MODULE_2__.getImageProps) is not a function
ex_web
at eval (./src/components/ExImage/index.jsx:24:96)
at Array.map (<anonymous>)
at ExImage (./src/components/ExImage/index.jsx:21:36)
at stringify (<anonymous>)
my code:
import NextImage, { getImageProps } from 'next/image';
...
// Map through each source config to generate the necessary <source> elements
const sourceElements = sources.map((source, index) => {
const { media, width, height, quality, src } = source;
const {
props: { srcSet },
} = getImageProps({
alt,
sizes,
width,
height,
quality,
src, // Source image
});
return <source key={index} media={media} srcSet={srcSet} />;
});
Answered by Berger Picard
This was a docker issue I think. I updated to 15 but it was still caching an older version. I ultimately had to delete all the containers and rebuild with no-cache
2 Replies
Berger PicardOP
So sort of got this working. I'm not actually sure why but it just refused to work when running next in docker. running it locally everything was fine.
Berger PicardOP
This was a docker issue I think. I updated to 15 but it was still caching an older version. I ultimately had to delete all the containers and rebuild with no-cache
Answer