외부 이미지 가져오기
-
[NextJS] 외부 주소에서 이미지 가져올 때..Programming/JavaScript & TypeScript 2022. 9. 7. 08:38
NextJS에서 외부 주소를 통해서 이미지를 가져올 때, 다음과 같은 오류가 발생한다. next.config.js에서 이미지 가져올 domain주소를 넣어줘야한다. 아래와 같이 images에 특정 domain을 넣어준다. 이렇게 하고 npm run dev를 다시 해줘야한다. images:{ domains:['via.placeholder.com'] } 전체 코드 /** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, experimental: { reactRoot: true }, swcMinify: true, images:{ domains:['via.placeholder.com'] } } module.export..