You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error in version 6.3.10: ReferenceError: React is not defined #5667
Using redocly-cli to create documentation based on OpenAPI, the latest version started failing about 20 minutes ago (for us) with the following error, pointing to this dependency.
ReferenceError: React is not defined
at Object.<anonymous> (/root/.npm/_npx/1738445911c9ab26/node_modules/styled-components/dist/styled-components.cjs.js:1:860)
at Module._compile (node:internal/modules/cjs/loader:1521:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
at Module.load (node:internal/modules/cjs/loader:1266:32)
at Module._load (node:internal/modules/cjs/loader:1091:12)
at Module.require (node:internal/modules/cjs/loader:1289:19)
at require (node:internal/modules/helpers:182:18)
at /root/.npm/_npx/1738445911c9ab26/node_modules/redoc/bundles/redoc.lib.js:2:109941
at /root/.npm/_npx/1738445911c9ab26/node_modules/redoc/bundles/redoc.lib.js:1831:3804
at /root/.npm/_npx/1738445911c9ab26/node_modules/redoc/bundles/redoc.lib.js:1831:3809
Reacted by Denis Frezzato, Giulio Albanese Solombrino, Francesco Intini, Kevin Hübner, kfu, Niklas Dörr, Denny, Marshall Brown, Simon, Guilherme Capanema de Barros and 44 more
Seems like the version 6.3.10 has a bug, looking into the CJS bundle it uses React as a global variable (void 0 === React.createContext) instead of require('react'). This crashes in Node.js where React is not global.
Reacted by Aman sharma, Jakub Janusz, Alexander Hawkings-Byass, Yagasaki7K, Valentin Carmignac, jun-pickeplus, John Maina and vsubbotskyy
Seems like the version 6.3.10 has a bug, looking into the CJS bundle it uses React as a global variable (void 0 === React.createContext) instead of require('react'). This crashes in Node.js where React is not global.
So what's the solution? Hold off on updating until they fix this problem?
Activity
tot-intini commentedon Feb 18, 2026
Seems like the version 6.3.10 has a bug, looking into the CJS bundle it uses React as a global variable
(void 0 === React.createContext)instead ofrequire('react'). This crashes in Node.js where React is not global.Yagasaki7K commentedon Feb 18, 2026
So what's the solution? Hold off on updating until they fix this problem?
The problem happens too in Next.js (v16.1.6)
peterson-tubini commentedon Feb 18, 2026
Same issue happening with me too
Arghadeep09 commentedon Feb 19, 2026
Same issue is generated
klasnasman commentedon Feb 19, 2026
Same here on a new Astro / Sanity project.
npm run sanity:generate gives me "ReferenceError: React is not defined"
Pinning styled-components to 6.3.9 fixes it
[ci]: pin styled-components version in tests (#90194)
quantizor commentedon Feb 19, 2026
On it!
fix: resolve React is not defined ReferenceError in CJS server build
fix: resolve React is not defined ReferenceError in CJS server build (#…
fix: resolve React is not defined ReferenceError in CJS server build (#…
quantizor commentedon Feb 19, 2026
Sorry about that, please try 6.3.11
[ci]: pin styled-components version in tests (vercel#90194)