ReferenceError: Can't find variable: globalThis

Hi,

We finally resolved this issue:

We used globalthis package and call the method shim() just before initialization of the Prismic Client (in a custom prismic helpers file).

We use this client on server and client side, so we needed to declare globalThis not only in _app.tsx or in our getServerSideProps in route templates.

// ~/utils/prismicHelpers.ts

import globalthis from "globalthis";
import * as prismic from "@prismicio/client";
import { endpoint } from "../prismicConfiguration";

/**
 * globalThis polyfill:
 * Prevent error on IOS/MacOS version 12.1 or before
 * ReferenceError: Can't find variable: globalThis
 */
globalthis.shim();

/**
 * PRISMIC CLIENT
 */
// Initialises the Prismic Client that's used for querying the API and passes it any query options.
const prismicClient = prismic.createClient(endpoint);

Thanks for your help!