You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The explicit prerelease alternative matches on its own, but adding * || makes it stop matching. The same result occurs with the alternatives reversed. This is reproducible from the unmodified v7.8.5 tag (Node v22.23.3).
The range constructor collapses the whole OR range to * when any alternative is a wildcard, before prerelease eligibility is checked. This discards the explicit prerelease alternative and changes the set of matching versions.
Expected Behavior
The README's range description says a range matches when at least one ||-separated comparator set matches, and its prerelease rule checks for an eligible comparator within a comparator set. Thus 1.2.3-alpha should match the explicit 1.2.3-alpha alternative even though the wildcard alternative does not admit prereleases. In #183, @isaacs explicitly noted that * || 1.0.0-prerelease is different from * for this reason.
The Range.constructor shouldn't collapse * || 1.2.3-alpha into just *, when includePrerelease is false and one of the other comparators has a prerelease version.
Activity
isaacs commentedon Sep 27, 2026
This is indeed a bug. Prerelease ranges cannot be collapsed into * if includePrereleases is false.