Skip to content

fix: widen React Router peer deps to caret ranges#3677

Merged
fredericoo merged 1 commit intomainfrom
fb-permissive-rr-peerdeps
Apr 9, 2026
Merged

fix: widen React Router peer deps to caret ranges#3677
fredericoo merged 1 commit intomainfrom
fb-permissive-rr-peerdeps

Conversation

@fredericoo
Copy link
Copy Markdown
Contributor

Context

Discussed in #3617 - exact React Router peer dep pinning causes npm scaffolding tests to fail with ERESOLVE when the skeleton template uses a newer minor version than the published hydrogen package declares.

Root Cause

Hydrogen and cli-hydrogen pin @react-router/dev and react-router to exact versions (e.g. "7.12.0") in peerDependencies. npm's strict resolver rejects installs when the project uses 7.14.0 but the published hydrogen expects exactly 7.12.0. pnpm and yarn are more lenient by default, which is why only npm scaffolding tests fail.

Solution

Widen peer deps from exact (7.12.0) to caret ranges (^7.12.0). This:

  • Allows any compatible minor/patch version within the 7.x range
  • Aligns with how we already handle vite peer deps (wide ranges like ^5.1.0 || ^6.2.1)
  • Is safe because hydrogen only uses stable public APIs from react-router (useFetcher, Link, useLocation, data, redirect, etc.) and type-only imports from @react-router/dev (Preset, Config, RouteConfigEntry)

Testing

  • npm scaffolding tests should pass once this is published alongside the Vite 8 PR
  • pnpm install still resolves correctly with the widened range

Exact peer dep pinning (e.g. "7.12.0") causes npm's strict resolver to
reject installs when the project uses a newer minor version. This creates
a chicken-and-egg problem: scaffolded projects can't install until a new
hydrogen version is published with the updated pin.

Widening to ^7.12.0 aligns with how we handle vite peer deps (wide
ranges) and is safe because hydrogen only uses stable public APIs from
react-router (useFetcher, Link, useLocation, etc.) and type-only imports
from @react-router/dev.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@shopify
Copy link
Copy Markdown
Contributor

shopify bot commented Apr 9, 2026

Oxygen deployed a preview of your fb-permissive-rr-peerdeps branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment April 9, 2026 5:13 PM

Learn more about Hydrogen's GitHub integration.

@fredericoo fredericoo marked this pull request as ready for review April 9, 2026 17:19
@fredericoo fredericoo requested a review from a team as a code owner April 9, 2026 17:19
Copy link
Copy Markdown
Contributor

@itsjustriley itsjustriley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 great call

@fredericoo fredericoo merged commit 92ab8e8 into main Apr 9, 2026
21 of 22 checks passed
@fredericoo fredericoo deleted the fb-permissive-rr-peerdeps branch April 9, 2026 17:44
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.

2 participants