question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Next - Images don't generate

See original GitHub issue

Hey 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:

  1. build doesn’t generate any images at all
  2. dev 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:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
yamiterucommented, Mar 19, 2021

Yeah that makes sense why it was loading the last imported image.

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.

I see, so I’m gonna create an issue over in the Vite repo. Thanks for debugging man!

0reactions
JonasKruckenbergcommented, Mar 19, 2021

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!

Edit:

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found