Home / Snippets / How to Configure Next.Js Image Hostname
How to Configure Next.Js Image Hostname cover

How to Configure Next.Js Image Hostname

2.1K

1 year ago

0 comments

In this short snippet you will learn how to prevent “Error: Invalid src prop” in Next Js. Let's get started!

Open next.config.js and add it in the ”images” config

Add the domain section for your backend / image domain server
/** @type {import('next').NextConfig} */
const nextConfig = {
    images: { domains: ['assets.example.com'], },
}

module.exports = nextConfig
Once you have done so restart the server and you should be able to see the image.
notion avatar

Alaz

Week-end developer currently experimenting with web, mobile, and all things programming.

Topics:

Frontend

Resource

Average

Average

Support Us

If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this