Skip to content

fix: do not enable devtools from Vite's optional-peer-dep stub - #324

Merged
birkskyum merged 1 commit into
solidjs:nextfrom
brenelz:fix/devtools-optional-peer-stub
Aug 23, 2026
Merged

fix: do not enable devtools from Vite's optional-peer-dep stub#324
birkskyum merged 1 commit into
solidjs:nextfrom
brenelz:fix/devtools-optional-peer-stub

Conversation

@brenelz

@brenelz brenelz commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Problem

Any Start app that does not install @solidjs/start-devtools fails in dev on 3.0.0-next.31:

Uncaught SyntaxError: The requested module '/@id/__vite-optional-peer-dep:@solidjs/start-devtools:@solidjs/vite-plugin' does not provide an export named 'DevToolbar'

resolveDevtools falls back to resolving the package from the plugin's own file (for pnpm-isolated installs where devtools is only a dependency of the plugin). But @solidjs/start-devtools is declared an optional peer dependency of the plugin, so when it is absent Vite does not return null for that resolution — it returns its __vite-optional-peer-dep: stub (an empty module). The plugin took the stub as a real resolution, enabled the toolbar, and the generated client entry imported DevToolbar from an empty module.

Fix

Treat an id starting with __vite-optional-peer-dep: as "not installed" in both resolution attempts.

Verification

  • Reproduced with the bare template + next.31 and no devtools installed; with the patched build the generated entry no longer imports devtools and the app boots with no console errors.
  • examples/start-client/test/run.mjs: 45/45 (toolbar still wraps the app when devtools is installed).

🤖 Generated with Claude Code

resolveDevtools falls back to resolving @solidjs/start-devtools from the
plugin's own file so pnpm-isolated installs work, but the package is an
optional peer dependency of the plugin, so when it is absent Vite returns
its __vite-optional-peer-dep: stub rather than null. The stub was taken
as a successful resolution and the generated client entry imported
DevToolbar from an empty module, breaking every app without devtools.
Treat the stub as not installed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Aug 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4cdb3af

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

This PR includes changesets to release 1 package
Name Type
@solidjs/vite-plugin 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

@pkg-pr-new

pkg-pr-new Bot commented Aug 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@solidjs/vite-plugin@324

commit: 4cdb3af

@birkskyum
birkskyum merged commit 473afd2 into solidjs:next Aug 23, 2026
6 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