Next.js Discord

Discord Forum

Image remotePattern set but error says that It dont.

Unanswered
Jonas F. Franke posted this in #help-forum
Open in Discord
On the both screenshots I had sent, you can see that I have configured the remotePattern and on the other one you see that nextjs thinks I didnt.

Im on NextJS version 14.0.4 and I use a middleware for localisation redirections.
The project is TypeScript.

What can I do? Can anybody help?

9 Replies

@Ray try `rm -rf .next` and restart the server
First of all, thank you for your response. I had deleted the .next directory right now and had restarted my server. The issue presists. Is there anything else I can try?
@Ray maybe just set the hostname `{ hostname: "flagcdn.com" }`
Okay, I tried that too and it didnt worked. Then I deleted the .next directory again and restarted my server and the issue still presists.
@Jonas F. Franke Okay, I tried that too and it didnt worked. Then I deleted the .next directory again and restarted my server and the issue still presists.
it works for me
even the response is 404
@Jonas F. Franke Okay, I tried that too and it didnt worked. Then I deleted the .next directory again and restarted my server and the issue still presists.
or try this
/** @type {import('next').NextConfig} */
const nextConfig = {
  images: {
    remotePatterns: [{ hostname: "*" }],
  },
};

export default nextConfig;
@Ray or try this ts /** @type {import('next').NextConfig} */ const nextConfig = { images: { remotePatterns: [{ hostname: "*" }], }, }; export default nextConfig;
I now have tried this too and deleted the .next directory and restarted the server. The issue presists. Anyway, thanks for your time. But imma stick with the html img tag now.
@Jonas F. Franke I now have tried this too and deleted the .next directory and restarted the server. The issue presists. Anyway, thanks for your time. But imma stick with the html img tag now.
oh I would say try with the images config only
/** @type {import('next').NextConfig} */
const nextConfig = {
  images: {
    remotePatterns: [{ hostname: "*" }],
  },
};

export default nextConfig;