개발/NEXTJS

바뀐 Nextjs 외부 Image 도메인 설정

LeeHyoGeun 2025. 1. 21. 13:05

⚠ The "images.domains" configuration is deprecated. Please use "images.remotePatterns" configuration instead.
와 같은 에러가 발생하여 claude에 물어보니 
외부 Image 도메인 설정하는 방법이 바뀌었다고 한다

아래와 같이 해야한다

 

const nextConfig: NextConfig = {
  /* config options here */
  images: {
    domains: [
      "ui-avatars.com", // 기본 아바타 이미지
      "lh3.googleusercontent.com", // 실제 사용자 이미지 도메인
    ],
  },
};

이전

const nextConfig: NextConfig = {
  /* config options here */
  images: {
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'ui-avatars.com',
        port: '',
        pathname: '/**',
      },
      {
        protocol: 'https',
        hostname: 'lh3.googleusercontent.com',
        port: '',
        pathname: '/**',
      },
    ],
  },
};

export default nextConfig;

이후