fix: widen React Router peer deps to caret ranges#3677
Merged
fredericoo merged 1 commit intomainfrom Apr 9, 2026
Merged
Conversation
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>
Contributor
|
Oxygen deployed a preview of your
Learn more about Hydrogen's GitHub integration. |
Merged
This was referenced Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Discussed in #3617 - exact React Router peer dep pinning causes npm scaffolding tests to fail with
ERESOLVEwhen the skeleton template uses a newer minor version than the published hydrogen package declares.Root Cause
Hydrogen and cli-hydrogen pin
@react-router/devandreact-routerto exact versions (e.g."7.12.0") inpeerDependencies. npm's strict resolver rejects installs when the project uses7.14.0but the published hydrogen expects exactly7.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:vitepeer deps (wide ranges like^5.1.0 || ^6.2.1)useFetcher,Link,useLocation,data,redirect, etc.) and type-only imports from@react-router/dev(Preset,Config,RouteConfigEntry)Testing
pnpm installstill resolves correctly with the widened range