Closed BernardA closed 4 years ago
I have the same issue. It seems the bug occurs only in builds of static pages. When I run dev server everything works fine.
I have exactly the same issue :(
Try require('image.png').default
Try
require('image.png').default
This fixed all my issues, thanks!
That did work. Thanks @andreisergiu98
To be clear, one needs the full path and, if you use ESLint, you have to disable global require:
// eslint-disable-next-line global-require
src={require('../../public/images/main-logo.png').default}
Can we re-open this please? This error still happening, Adding .default
does fix it for some images and broke it for some, Not sure what's happening.
I have the same problem and although default solves it, I feel it is still a problem that needs addressing as it is not in documentation :)
This seems to only happens with files that were under the inlineimagelimit
threshold which get turned into a data string.
The temporary fix seems to be setting inlineimagelimit
to -1 and update to 3.0 once it's stable
"next-optimized-images": "^2.6.2"
Images are not showing. The resulting HTML is like below:
Image originals are stored on
/public/images
as per Nextjs docs.I run both
npm run dev
andnpm run build
with the same result.For
build
I also checked on/.next/static/
and found no folder namedimages
as I understand it should be the case.next.config.js
On /src/components/header.js
Excerpt from package.json