Skip to content

Conversation

@dulapahv
Copy link

@dulapahv dulapahv commented Nov 8, 2025

PR description

The custom Cloudflare image loader was causing Next.js warnings in development mode:

Image with src "..." has a "loader" property that does not implement width. Please implement it or use the "unoptimized" property instead.

This occurred because the loader was returning the raw src without width parameters when NODE_ENV === "development", which Next.js interprets as not implementing the width parameter.

Summary of Changes

  • Updated image-loader.ts to include width and quality params in development mode

const paramsString = params.join(",");
if (process.env.NODE_ENV === "development") {
// Serve the original image when using `next dev`
return `${src}?${paramsString}`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this wouldn't actually return proper query params since they're joined with a comma.

it's possible that some remote image urls people might use could attempt to interpret that width parameter which would have a value of something like 500,quality=1. Perhaps we should use the ampersand in dev mode so that they're proper query params?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for that. I've updated it to use & in dev query params.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants