Next.js Discord

Discord Forum

How do I add remotePatterns to my config?

Answered
WhyFencePost (Ping Reply) posted this in #help-forum
Open in Discord
My config rn is the follwing, and i need to add the pattern, and idk how
/** @type {import('next').NextConfig} */
const nextConfig = {};

export default nextConfig;


and i need to merge in the following;

module.exports = {
  images: {
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'images.unsplash.com',
        port: '',
      },
    ],
  },
}


also is that remotePatterns correct?
Answered by joulev
/** @type {import('next').NextConfig} */
const nextConfig = {
  images: {
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'images.unsplash.com',
        port: '',
      },
    ],
  },
};

export default nextConfig;
View full answer

4 Replies

Siberian
you would put it in the nextConfig object
i tried that, cant get it to work
/** @type {import('next').NextConfig} */
const nextConfig = {
  images: {
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'images.unsplash.com',
        port: '',
      },
    ],
  },
};

export default nextConfig;
Answer
thanks