react-reconciler renderers (react-three-fiber) crash at import: the react shim has no __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE (0.2.1, 0.3.1)

Offen
#157 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
55/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
react, typescript

Rechercherichtung

Start by reading the Vite plugin’s React shim at dist/react/index.js and tracing how the plugin substitutes it during dependency pre-bundling. Check how react-reconciler accesses __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, then compare the proposed shim change with the alternative importer-level skip behavior. Done when a reproducer using @react-three/fiber imports and mounts successfully, or the supported limitations and workaround are documented.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

What happens

Any react-reconciler based renderer breaks under the Vite plugin. With @react-three/fiber in the app, the first import of its module throws and the page never renders:

TypeError: Cannot read properties of undefined (reading 'S')
    at createReconciler (react-three-fiber.esm-*.js)

The pre-bundled fiber chunk resolves react to @tanstack/redact/dist/react/index.js. react-reconciler reads React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE at module evaluation and then .S on it; the shim does not export that object, so the read is on undefined. Same in 0.2.1 and 0.3.1 (dist/react/index.js has no __CLIENT_INTERNALS in either).

Reproduction

  • Vite 8.3.4, @vitejs/plugin-react 6.1.2, react / react-dom 19.3.1, @react-three/fiber 9.8.2, three 0.186.1, @tanstack/redact 0.2.1 (also 0.3.1).
  • vite.config.ts: plugins: [viteReact(), redact()].
  • Render any component that imports Canvas from @react-three/fiber.

Expected: the canvas mounts. Actual: the error above at import time; Storybook and Vitest, which do not run the plugin, render the same component fine.

What I tried

skip is global per specifier, so there is no way to leave one package (or one subtree) on real React while the rest of the app uses Redact. Removing the plugin fixes it.

Ask

Either expose the client internals that react-reconciler needs so custom renderers can host their own root inside a Redact tree, or document that react-reconciler renderers (@react-three/fiber, @react-pdf/renderer, ink) are out of scope and let skip exclude an importer, not only a specifier.

Vorherrschende Sprache
TypeScript
Sterne
537
Forks
22
Ø Merge
10 Std. 27 Min.
Gemergte PRs (30 T.)
40

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus TanStack/redact

Alle Issues in TanStack/redact

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.