fix: do not enable devtools from Vite's optional-peer-dep stub - #324
Merged
Merged
Conversation
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 detectedLatest commit: 4cdb3af The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
commit: |
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.
Problem
Any Start app that does not install
@solidjs/start-devtoolsfails in dev on3.0.0-next.31:resolveDevtoolsfalls 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-devtoolsis declared an optional peer dependency of the plugin, so when it is absent Vite does not returnnullfor 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 importedDevToolbarfrom an empty module.Fix
Treat an id starting with
__vite-optional-peer-dep:as "not installed" in both resolution attempts.Verification
examples/start-client/test/run.mjs: 45/45 (toolbar still wraps the app when devtools is installed).🤖 Generated with Claude Code