From 4efe097e28abda9a7b11ba43c63ff11cc3fdd535 Mon Sep 17 00:00:00 2001 From: Robert Reinhard Date: Mon, 9 Sep 2024 15:43:39 -0700 Subject: [PATCH] Adding hack for loading next/image into sanity-next --- packages/next/src/NextVisual.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/next/src/NextVisual.tsx b/packages/next/src/NextVisual.tsx index 1f4571a..a707800 100644 --- a/packages/next/src/NextVisual.tsx +++ b/packages/next/src/NextVisual.tsx @@ -1,4 +1,8 @@ -import Image from 'next/image' +// `next/image` as importing as { default: Image, __esmodule: true } when +// this file was loaded by @react-visual/sanity-next. This is my hack to fix +import _Image from "next/image"; +const Image = ("default" in _Image ? _Image.default : _Image) as typeof _Image; + import type { ReactElement } from 'react' import { makeImagePlaceholder } from './lib/placeholder'