Worked Scenario: A Plugin Narrows Its Peer Range and Installs Start Failing
Hypothetical, with made-up names and assumed numbers. "Plugin P" extends a host framework, "Host H". The plugin's authors changed one line in package.json and called it a minor release. Here is how that line rippled outward, and how the team could have shipped the same improvement without stranding anyone.
Starting point
Plugin P 1.6.0 declares:
{
"name": "plugin-p",
"version": "1.6.0",
"peerDependencies": {
"host-h": "^4.0.0 || ^5.0.0"
}
}
Assume about half of its users are still on Host H 4.x, because Host H 5 needed configuration changes many teams had not made yet. Plugin P wanted to use an API that only exists in Host H 5.2 and later, so for 1.7.0 the range became "^5.2.0".
What users experienced
Since npm 7, peer dependencies are installed automatically and a conflicting peer causes the install to stop with an ERESOLVE error rather than a quiet warning. A project on Host H 4.8 that ran npm update was therefore offered Plugin P 1.7.0 (it matches ^1.6.0), and the resolver then refused, because 1.7.0 rejects Host H 4.8. The suggested workaround in the error message, --legacy-peer-deps, makes the install succeed but hides the real incompatibility until the plugin calls a function that does not exist.
Under the half-and-half assumption, roughly one in two users hit a wall on their next update. For a team with a lockfile it showed up in a dependency-bot pull request; for a team without one it showed up in CI on an unrelated change, which is the most confusing place to discover it.
Was it really a minor change?
Dropping support for a host version that the previous release accepted removes a working configuration. By the usual reading of the semver.org rules, that is a breaking change for the people on Host H 4, even though no plugin function changed signature. The safer convention, used by many plugin ecosystems, is: widening a peer range is minor, narrowing it is major.
| Change to peerDependencies | Effect on existing users | Suggested bump |
|---|---|---|
| Add a newer host major to the range | None; more setups accepted | Minor |
| Raise the minimum within the same host major | Users below the new minimum blocked | Major, or minor with clear notice if the old minimum is known-broken |
| Drop an entire host major | Every user on that major blocked | Major |
A better release plan
- Ship the new capability in
1.7.0behind a feature check: if the Host H API exists, use it; otherwise fall back to the old code path. The peer range stays wide. - Announce in the changelog that 2.0 will require Host H 5.2.
- Publish
2.0.0with the narrow range and remove the fallback. - Keep backporting security fixes to 1.x for an announced period so users on Host H 4 are not forced into two migrations at once.
For background on how npm, pnpm and Yarn treat peers, see peer dependencies explained.