Skip to content

Commit

Permalink
Mock Next.js <Image/> in storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamigami55 committed Oct 13, 2021
1 parent 60ca660 commit 9ff9eeb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ export const parameters = {
default: 'light',
},
}

// Mock Next.js <Image/> component in storybook
// https://github.com/vercel/next.js/issues/18393#issuecomment-783269086
import * as NextImage from 'next/image'
const OriginalNextImage = NextImage.default
Object.defineProperty(NextImage, 'default', {
configurable: true,
value: (props) => <OriginalNextImage {...props} unoptimized />,
})

0 comments on commit 9ff9eeb

Please sign in to comment.