Skip to content

fix: declare @solidjs/router as an optional peer dep below v2 - #2263

Merged
birkskyum merged 1 commit into
solidjs:mainfrom
birkskyum:t3code/restrict-router-peer-range
Jul 28, 2026
Merged

fix: declare @solidjs/router as an optional peer dep below v2#2263
birkskyum merged 1 commit into
solidjs:mainfrom
birkskyum:t3code/restrict-router-peer-range

Conversation

@birkskyum

Copy link
Copy Markdown
Member

Problem

@solidjs/start declares no relationship to @solidjs/router at all: it is not a dependency, not a peer dependency, and there is no import of it anywhere in packages/start/src. The router integration is entirely user-land, with FileRoutes in src/router.tsx returning plain route configs.

That means nothing constrains the pairing in either direction, and an incompatible router can be installed alongside Start with no signal to the user.

Change

Declare the router as an optional peer dependency with an explicit range:

"peerDependencies": {
  "@solidjs/router": ">=0.16.0 <2.0.0-0",
  "vite": "^8 || ^9"
},
"peerDependenciesMeta": {
  "@solidjs/router": { "optional": true }
}

Router v2 is expected to target Solid v2, so @solidjs/start v2 should accept 0.16 and up but stay below v2. peerDependenciesMeta keeps this advisory for apps that do not use the router at all.

The upper bound is <2.0.0-0 rather than <2.0.0 on purpose. Under default semver both exclude a stable 2.0.0, but <2.0.0 still admits 2.0.0-* prereleases under prerelease-inclusive resolution. <2.0.0-0 excludes them either way.

Verified

Range behavior:

version in range
0.15.4 no
0.16.00.16.3 yes
1.0.0, 1.9.9 yes
2.0.0-next.1, 2.0.0 no

Install behavior, checked against a synthetic package carrying the same declaration:

  • no router installed: installs clean, confirming the optional flag works
  • router 0.16.3: installs clean
  • an out-of-range router: npm fails with ERESOLVE listing peerOptional @solidjs/router, and pnpm peers check reports it as an unmet peer

Note that inside this monorepo the constraint will not visibly warn, because @solidjs/start is linked via workspace:* and pnpm's auto-install-peers simply installs a satisfying version into the packages/start importer. That is the new lockfile line. The user-facing behavior was verified separately via a packed tarball.

Worth a maintainer check

The currently published @solidjs/router@1.0.0-next.11 (the next tag) declares peers of solid-js: >=2.0.0-beta.22 <2.0.0-experimental.0 and @solidjs/web: ^2.0.0-beta.26, so that prerelease line targets Solid v2. The same applies to the 0.17.0-next.* versions that preceded it.

This does not break the range as written: both prerelease lines are excluded under default resolution anyway, since a prerelease only matches when a comparator shares its major.minor.patch tuple. So a stable 1.x is accepted while today's 1.0.0-next.* is not.

It does mean the bound depends on the release plan. If the v1 numbering is being repurposed and a Solid-v1-targeting 1.0.0 supersedes those prereleases, this range is correct. If those prereleases are the future v1, the bound should be <1.0.0-0 instead.

@solidjs/start had no declared relationship to @solidjs/router at all,
so nothing prevented an incompatible pairing. Router v2 is expected to
target Solid v2, so constrain the accepted range to >=0.16.0 <2.0.0-0.

The peer is marked optional via peerDependenciesMeta, since the router
integration is entirely user-land and apps that do not use it are
unaffected.

The upper bound uses <2.0.0-0 rather than <2.0.0 so that 2.0.0
prereleases are excluded under prerelease-inclusive resolution too.
@changeset-bot

changeset-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 502367e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/start Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify

netlify Bot commented Jul 28, 2026

Copy link
Copy Markdown

Deploy Preview for solid-start-landing-page ready!

Name Link
🔨 Latest commit 502367e
🔍 Latest deploy log https://app.netlify.com/projects/solid-start-landing-page/deploys/6a68eb5ed359fc00080be651
😎 Deploy Preview https://deploy-preview-2263--solid-start-landing-page.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new

pkg-pr-new Bot commented Jul 28, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@solidjs/start@2263

commit: 502367e

@birkskyum
birkskyum requested a review from katywings July 28, 2026 17:51

@lxsmnsyc lxsmnsyc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Image

@birkskyum
birkskyum merged commit f15724b into solidjs:main Jul 28, 2026
11 checks passed
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