errors/next-image-upgrade-to-13.mdx
Starting in Next.js 13, the next/image component has undergone some major changes.
Compared to the legacy component, the new next/image component has the following changes:
<span> wrapper around `` in favor of native computed aspect ratiostyle prop
layout prop in favor of style or classNameobjectFit prop in favor of style or classNameobjectPosition prop in favor of style or classNameIntersectionObserver implementation in favor of native lazy loading
lazyBoundary prop since there is no native equivalentlazyRoot prop since there is no native equivalentloader config in favor of loader propalt prop from optional to requiredRun the next-image-to-legacy-image codemod to automatically change next/image imports to next/legacy/image, for example:
npx @next/codemod next-image-to-legacy-image .
After running this codemod, you can optionally upgrade next/legacy/image to the new next/image with another codemod, for example:
npx @next/codemod next-image-experimental .
Please note this second codemod is experimental and only covers static usage (such as <Image src={img} layout="responsive" />) but not dynamic usage (such as <Image {...props} />).