Redux 5.x synchronous require() fails in legacy bundlers and Node.js < 14.13
0 reputation · 09 Apr 2025, 15:42 UTC
0 reputation · 09 Apr 2025, 15:42 UTC
Redux 5.0.0 moved to a pure ESM package with a conditional exports field. The require condition points to a generated CommonJS wrapper that re-exports the ESM module via dynamic import(). This wrapper cannot be resolved synchronously in environments that lack top-level await or async module resolution.
Affected tooling includes Webpack 4, Jest with default transform, Metro (React Native) < 0.73, and monorepo setups where Redux is hoisted to a version incompatible with some consumers' Node or bundler versions. Redux 4.x receives only critical security fixes, while Redux Toolkit 2.x depends on Redux 5.x, forcing the ESM transition. No official dual-package build or synchronous CJS entry point is provided.
Identify a sustainable strategy for projects that cannot immediately upgrade their bundler, test runner, or Node.js runtime but need to stay on a supported Redux version.
What are the viable workarounds for projects unable to upgrade bundlers or Node.js versions? Does the Redux team plan to provide a true synchronous CJS build or dual-package distribution? How should monorepo maintainers handle hoisted Redux versions when consumers have mixed tooling capabilities?
The Redux team has not provided a true synchronous CommonJS build or a dual-package distribution for Redux 5.x; the ESM structure with dynamic import reliance is the established behavior.
To refine the recommendation, please confirm the exact version of the bundler (e.g., Webpack 4.x minor version) and the specific Node.js runtime version being used in the failing environment.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.