i am trying to use nextjs 13 with prismic but a got an error when put The PrismicPreview in the layout file.
- I also tryed to use template file put got same error.
- When i remove PrismicPreview component the error leave it
The Error that i got is
TypeError: Cannot read properties of null (reading 'basePath')
'use client';
import { PrismicProvider } from '@prismicio/react';
import React from 'react';
import Link from 'next/link';
import { PrismicPreview } from '@prismicio/next';
import Providers from './providers';
import { repositoryName, linkResolver } from '../lib/prismicio';
function RootLayout({ children }: { children: React.ReactNode }) {
return (
<PrismicProvider
linkResolver={linkResolver}
internalLinkComponent={({ href, ...props }) => (
<Link href={href}>
<a {...props} />
</Link>
)}
>
<html lang="pt-br">
<head>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link
rel="preconnect"
href="https://fonts.gstatic.com"
crossOrigin="true"
/>
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap"
rel="stylesheet"
/>
<meta charSet="UTF-8" />
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
</head>
<body>
<PrismicPreview repositoryName={repositoryName}>
<Providers>{children}</Providers>
</PrismicPreview>
</body>
</html>
</PrismicProvider>
);
}
export default RootLayout;