-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[canary] Using sizes prop triggers non-fatal error #169
Comments
I gave up and stopped using the |
Hi @brandonpittman Regarding the message, I'll try to also get rid of it. If you have 4 images and want to provide 3 sizes each, that already results in 12 images. And since those 12 images get compiled parallel, this warning comes up. But I'll see what I can do here. (After updating, it is expected for all images to re-compile once) |
@cyrilwanner Does seem a bit faster with canary.2. However, this issue is now coming up.
Only seems to be happening with images that have dynamic sources. Those dynamic sources worked with canary.0. Yes, the plugin is defined in .babelrc. {
"presets": ["next/babel"],
"plugins": ["react-optimized-image/plugin"]
} |
Sorry for the error, that looks like a bug as dynamic sources should work generally. |
@cyrilwanner This is the component that was bugging out. The image stuff is currently commented out due to the error I was getting. https://github.com/brandonpittman/next-blog/blob/master/src/components/media_card.js |
@cyrilwanner great work. Looking forward to using this moving forward. 🙌
I can confirm this as well. The dynamic paths return an error while the static path succeeds Error
Success:
The same is true with/without the Interestingly when I found this: webpack/webpack#6680 (comment). Looks like the filename can be dynamic but the extension can not? Success:
For now, I plan on making a workaround to check the extension on the image, as I am already getting the image data in static props to get the ratio to prevent layout shifting. Looking forward to learning more about this, and again thanks for your work. |
Thank you both for the feedback! It was indeed a bug in Also, please note that if you are using a dynamic require, all images matching the path before the variable get compiled because webpack does not know during build which values the variable could have. So if you have |
@cyrilwanner I can confirm the errors are gone. Can you recommend a better dynamic image solution? I'm wondering how Gatsby Image and Gridsome's image component manage to be so quick when converting images with Sharp. |
In general, as mentioned above, splitting your images into different subfolders (which are not part of the dynamic variable) improves it a lot. Also, Sharp is generally way faster but provides worse results compared to the image optimization tools used in |
@cyrilwanner Wow, the last update fixed my issues and the builds seem super fast again. (Cache is working its magic.) Closing this. 🥳 |
Any time I apply the sizes prop, I get this. Given enough time, the build will proceed. Only seems to happen once per server run, not on each page visit. Build unaffected, so deploys are possible. Just causes a weird slow down any time the dev server is spun up.
The text was updated successfully, but these errors were encountered: