Next - Images don't generate
See original GitHub issueHey so I’ve tried the next branch today and whilst I was trying to find the easiest and least painful way of importing a directory full of images in different sizes and formats.
There are 2 issues:
build
doesn’t generate any images at alldev
generates only the last imported image and uses it as src in all other images (but other data such as width or height are correct)
Here is the repo with the issue: https://github.com/YamiteruXYZ/imagetools-workbench
BTW I’m gonna use this repo to experiment with imagetools and it might be a source of some demos or starters.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Nextjs: Unable to load images from static folder
Does it work when trying to load static images into dynamic files - i.e /pages/stuff/[id].js Using the root Public folder is not working...
Read more >image component in next js is not working in development ...
I tried to preview my web app.. in my local machine I was using the image component but the image is not loading...
Read more >next/image | Next.js
First, the value of sizes is used by the browser to determine which size of the image to download, from next/image 's automatically-generated...
Read more >Working with images in Next.js
Rendering images in Next.js for the first time can be frustrating, especially for beginners who are not fond of reading documentation.
Read more >How to use the Next.js Image Component Effectively
If you don't care about optimized images or the above options don't work for your use case, you can always just fall back...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah that makes sense why it was loading the last imported image.
I see, so I’m gonna create an issue over in the Vite repo. Thanks for debugging man!
I’m so stupid duh… You know what the issue was? 😆 Images IDs were basically the url params hashed, since the same configuration always produces the same image, but it was only the url params and so the image path was not taken into account. How stupid…
Anyway, the fixed version should be available from npm soon!
And regarding your second issue with images not been generated in build mode, it seems like Vite is not picking up the import at all and that’s why the images weren’t included in the build. I don’t know how or why it is different in build mode, but Vite-imagetools has nothing to do with that. It never gets told about any images in the first place.