I am helping a friend out with a Next.js project that utilizes Sanity. When attempting a preview build on Vercel, we keep getting the following error:
Type error: Page "src/app/studio/[[...tool]]/page.tsx" does not match the required types of a Next.js Page.
"viewport" is not a valid Page export field.
// ./src/app/studio/[[...tool]]/page.tsx
import {NextStudio} from 'next-sanity/studio'
import config from '../../../../sanity.config'
export const dynamic = 'force-static'
export {metadata, viewport} from 'next-sanity/studio'
export default function StudioPage() {
return <NextStudio config={config} />
}
Locally, everything works fine. Has anyone else run into this issue before? I’m new to Vercel, Sanity and Next.js, but my jellies tell me it may be an environmental difference between Vercel and my local environment.
One thing I forgot to mention is that this only happens with preview builds, production builds are fine. Are these errors ignored for production builds? I’ve tried excluding src/app/studio in tsconfig.json with no luck either.