@prismicio/react is currently not compatible with some ES module (ESM) environments, including Remix.

You can patch the issue within your project using patch-package. The patch is temporary until @prismicio/react is updated.

<aside> ⚠️ This patch is not necessary for Next.js, Nuxt, and SvelteKit projects.

Only perform this patch if you are having issues using @prismicio/react in your project.

</aside>

How to patch @prismicio/react

  1. Open node_modules/@prismicio/react/package.json in your text editor.

    Add "type": "module" in the file.

    // node_modules/@prismicio/react/package.json
    
      {
        "name": "@prismicio/react",
        "version": "2.8.0",
        "description": "React components and hooks to fetch and present Prismic content",
    +   "type": "module",
        "keywords": [
          "typescript",
          "prismic",
          "react",
          "cms",
          "hook",
        ],
    
  2. Run patch-package. A patch file will be saved in a patches directory.

    npx patch-package @prismicio/react --exclude 'nothing'
    
  3. Add a postinstall script to your project’s package.json.

    // package.json
    
      {
        "scripts": {
    +     "postinstall": "patch-package"
        }
      }
    
  4. Install patch-package.

    npm install --save-dev patch-package
    

Now, @prismicio/react will be patched anytime you install dependencies.