Skip to content

Conversation

@ajphilton
Copy link

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:

  • 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:
#544

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
@vercel
Copy link

vercel bot commented Nov 27, 2025

@ajphilton is attempting to deploy a commit to the medusajs Team on Vercel.

A member of the Team first needs to authorize it.

@ajphilton
Copy link
Author

Additional context on React APIs / warnings

After pinning React/Next to stable versions (React 18.x / Next 14.x), the build now succeeds reliably.
However, the starter still imports useActionState from react in several account/checkout components (e.g. modules/account/components/address-card/*, some checkout modules).

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:
1. Dependencies – This PR fixes the RC / overrides situation by pinning React/Next to stable 18/14, which resolves build/runtime issues like should not be imported outside of pages/_document.
2. APIs – To be fully React 18–compatible, the starter will need to replace useActionState usage with a React 18–safe pattern (e.g. useState + useTransition), or alternatively move the starter fully to React 19 and update deps accordingly.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant