Skip to content
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

Send "original" URL as src attribute #68

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

andershagbard
Copy link
Contributor

Resolves #50

Next.js sends an error if src is the same as the optimized image.

In this case, we sent the optimized src attribute back to the getImgProps function

@lorenzodejong
Copy link
Owner

lorenzodejong commented Jul 23, 2024

I understand the fix you're trying to implement here, however this will impact some of the flexibility that the library provides. By defining a base image without any customization options from the imageBuilder option, you remove the capability of cropping/scaling and other image transformations.

This will not be an issue from any of the images from the srcset attribute, however will impact the src image as a fallback.

Could you elaborate on the specific way this fixes the issue in the library? If we know the root cause of the issue, we may be able to come up with a fix which doesn't impact the customizability of the library.

@andershagbard
Copy link
Contributor Author

The passed src seems to just be the original resource for the URL.

The src attribute passed to the img tag is still optimized. Check this line: https://github.com/vercel/next.js/blob/00ed837bb4b71ce0c30256e4d07638225b31a7e5/packages/next/src/shared/lib/get-img-props.ts#L231

@andershagbard
Copy link
Contributor Author

@lorenzodejong I've updated the tests, but I am unsure if they are actually worth having anymore. It's the loader function result which should be tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants