fwouts / viteshot

Viteshot 📸 is a fast and simple component screenshot tool based on Vite.

Home Page:https://viteshot.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NextJs 'next/image' support

marcoNonvanilla opened this issue · comments

Viteshot does not fully support NextJs. Things like next image currently don't work.

our testable components which use next/image are configured this way:

import * as NextImage from 'next/image';
const OriginalNextImage = NextImage.default;

if (process.env.TEST_ENV === 'vreg') {
  Object.defineProperty(NextImage, 'default', {
    configurable: true,
    value: (props) => (
      <OriginalNextImage {...props} unoptimized loader={({ src }) => src} />
    ),
  });
}