Skip to content

nextra ≥4.3.0 crashes in RSC context: useMemoCache called through wrong React dispatcher #5022

Description

@vu-dao-93

Description

All nextra versions ≥4.3.0 crash at build time when the app uses React Server Components. The error is:

TypeError: Cannot read properties of undefined (reading 'useMemoCache')

or a variant where useMemoCache is called through the wrong React dispatcher in the RSC context.

Root cause

nextra 4.3.0 introduced a dependency on react-compiler-runtime@^19.1.0-rc.2. This package calls useMemoCache via the React dispatcher — but in the RSC build pass, the dispatcher used is not the full client dispatcher, so useMemoCache is not available at the point it is called.

nextra 4.2.17 uses an older experimental compiler runtime that does not trigger this path, and builds successfully.

Reproduction

  1. Create a Next.js 15 app with nextra ≥4.3.0
  2. Run next build
  3. Build crashes with a useMemoCache error during the RSC compilation pass

Workaround

Pin to nextra@4.2.17 and nextra-theme-docs@4.2.17.

Environment

  • nextra: 4.3.0–4.6.1 (all affected)
  • next: 15.x
  • react: 19.x
  • node: 22.x

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions