Downgrade Next.js and React dependencies for compatibility#545
Downgrade Next.js and React dependencies for compatibility#545ajphilton wants to merge 1 commit into
Conversation
This PR fixes the breaking issue caused by the upgrade to Next.js 15 and React 19 RC. The current starter template depends on @medusajs/ui and Radix components that require React 18 and Next.js 14. The forced resolutions in package.json upgrade React and React-DOM to 19.0.0 RC, and Next.js resolves to 15.x. This produces a build-time failure: <Html> should not be imported outside of pages/_document. This error happens because Next.js 15 changes the Document handling and the starter template still relies on the Next 14 pages router (_document.tsx). This PR: - Pins Next.js to 14.2.5 (latest stable v14 compatible with pages router) - Pins React and React-DOM to 18.3.1 (required by @medusajs/ui) - Removes RC resolutions and overrides forcing React 19 - Restores compatibility with Medusa V2 starter template - Removes peer dependency warnings and resolves the build error After applying this change: - `yarn build` works with zero errors - The storefront runs correctly on Next 14 - @medusajs/ui and Radix components function as expected - No `<Html>` import errors occur Discussion and diagnostic details here: medusajs#544
|
@ajphilton is attempting to deploy a commit to the medusajs Team on Vercel. A member of the Team first needs to authorize it. |
|
Additional context on React APIs / warnings After pinning React/Next to stable versions (React 18.x / Next 14.x), the build now succeeds reliably. On React 18 this emits warnings: React does not export useActionState because useActionState is only available in React 19. So there are now two separate follow-ups to consider: The current change is scoped intentionally to the dependency side. I’m happy to follow up with a separate PR to replace useActionState if you’d like to keep the starter on React 18 for now. |
This PR fixes the breaking issue caused by the upgrade to Next.js 15 and React 19 RC.
The current starter template depends on @medusajs/ui and Radix components that require React 18 and Next.js 14. The forced resolutions in package.json upgrade React and React-DOM to 19.0.0 RC, and Next.js resolves to 15.x. This produces a build-time failure:
should not be imported outside of pages/_document.This error happens because Next.js 15 changes the Document handling and the starter template still relies on the Next 14 pages router (_document.tsx).
This PR:
After applying this change:
yarn buildworks with zero errors<Html>import errors occurDiscussion and diagnostic details here:
#544