No images were found to optimize although I use Image-component in code
See original GitHub issueFirst of all thank you for your work on this. It is exactly what I need in my Next.js project in combination with a headless cms. Unfortunately I do have an issue I cannot resolve. I hope you can help me.
Describe the bug Although I use the Image component from next/image in my code I keep getting the ‘No images were found to optimize. (Maybe you never used the image component.)’ console log during next export. I noticed that there is also no file custom-optimized-images.nd.json in my .next folder. I suppose this is generated during next build.
To Reproduce Steps to reproduce the behavior:
- Use Image component in the code
- Build the app via next build (or
BASE_PATH=staging npx env-cmd -f ./environments/.env.staging next build
in my case) - Export the app via next export and optimize image via
next export && next-export-optimize-images
- Console log shows
No images were found to optimize. (Maybe you never used the image component.)
Expected behavior Find Image components and optimize used images from code.
Additional context
I use the Image component like this:
The source of the image is an external url directly from the cms.
The first time I did a local build and export, I saw the external images were downloaded but after that I only see the above notification.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6 (3 by maintainers)
The ‘future’ version works. Thanks!
@dc7290 thank you for your reply and sorry for my late reponse. I’ve used the package in a project but the project was in a hurry so at the end I did not use the package. I have tried it again with the version 1.9.0 but unfortunately I still get the same notice. I think it is an error at my end somewhere. Nevertheless, I will keep the code as it is right now because it is already in production. Maybe I need the package in the future; thanks for you work!
@samuel-2018 thanks for the heads up. I checked again but I was using the normal next/image import back then. I hope you can enjoy the package with the next/future/image in the latest version.