Skip to content

Commit

Permalink
fix(vercel#39807): ignore width/height from webpack with "fill"
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Aug 23, 2022
1 parent 77cca28 commit 9d9ab2f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/next/client/future/image.tsx
Expand Up @@ -591,8 +591,11 @@ export default function Image({
blurDataURL = blurDataURL || staticImageData.blurDataURL
staticSrc = staticImageData.src

height = height || staticImageData.height
width = width || staticImageData.width
// Ignore width and height (come from the bundler) when "fill" is used
if (!fill) {
height = height || staticImageData.height
width = width || staticImageData.width
}
if (!staticImageData.height || !staticImageData.width) {
throw new Error(
`An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ${JSON.stringify(
Expand Down

0 comments on commit 9d9ab2f

Please sign in to comment.