fix: make the package installable with strict peer resolution - #185
Open
razor-x wants to merge 1 commit into
Open
fix: make the package installable with strict peer resolution#185razor-x wants to merge 1 commit into
razor-x wants to merge 1 commit into
Conversation
Installing nextlove failed with ERESOLVE on every Next.js version, in two mutually exclusive ways: - On Next.js 15 and 16, the required nextjs-server-modules peer resolved to 4.8.2, whose own next peer caps at ^12 || ^13 || ^14. - On Next.js 14 and below, the react and react-dom peers of >=19 conflicted with the React 18 that those Next.js versions pin. The repository never saw either failure because its lockfile pins nextjs-server-modules 2.5.1, which declares no next peer, and because the install job relaxed peer resolution. Drop the react and react-dom peers, which were never satisfiable alongside the supported Next.js range and are unused: nothing in the package imports React, and Next.js already declares its own React peers. Mark nextjs-server-modules optional, since only the nsm command needs it and that command is a passthrough the built output never references. That command now explains what to install instead of failing on a bare module resolution error. Install the package under strict peer resolution in CI against both ends of the supported Next.js range so an unsatisfiable peer range fails the build. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UEGs8gB5heekV7MhjPMtSp
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.
Installing
nextlovefails withERESOLVEon every Next.js version. There are two independent blockers, and they are mutually exclusive — there is no Next.js version where the package installs.nextjs-server-modules: ">=1"peer resolves to 4.8.2, whose ownnextpeer caps at^12 || ^13 || ^14react/react-dompeers of>=19conflict with the React 18 those Next.js versions pinSo the declared
next: ">=12"range is unsatisfiable in both directions.Reproduced against a packed tarball on Next.js 16:
and on Next.js 14:
Why CI did not catch this
Two reasons, both of which this PR closes:
nextjs-server-modules@2.5.1, which declares nonextpeer, so installs inside the repository resolve fine. Consumers resolving>=1get 4.8.2.installjob ran with--legacy-peer-deps, under a comment describing this exact conflict as an accepted limitation rather than a defect.Changes
package.jsonreactandreact-dompeers. Nothing insrc/imports React — this is a server-side API library — and Next.js already declares its own React peers, so consumers always have a compatible copy. These peers only ever narrowed the installable set.nextjs-server-modulesoptional. Only thensmcommand needs it, and that command is a one-line passthrough; the builtdist/contains no reference to it. npm now skips it rather than pulling in a version that conflicts with the consumer's Next.js.prettierandtypescriptstay required — both are genuinely imported at runtime by the generators.nsm-bin.js— since the peer is no longer auto-installed, the command now explains what to install instead of failing on a bareERR_MODULE_NOT_FOUND. It still passes through untouched when the package is present..github/workflows/check.yml— theinstalljob drops--legacy-peer-depsand gains a Next.js^16/^14matrix leg, so it now tests for this bug instead of working around it.Verification
nextlove,nextlove/generators, andnextlove/exception-middlewareall import.nextjs-server-modulesis no longer installed into the consumer tree, and thatnsmstill passes through correctly when it is installed alongside.typecheck, andlintpass.Note
Removing a peer dependency and marking one optional are both relaxations, so no consumer that installs today is affected. Committed as
fix:rather thanfix!:on that basis — flagging it in case you would rather it land as a breaking change given the beta base.Generated by Claude Code