Repository navigation
Conversation
- `@solidjs/start-devtools/vite` exports a Vite plugin. In an app served from an index.html, it adds a script that mounts the toolbar during `vite dev`, so the app needs no JSX for it. - It applies to the dev server only. Builds, `vite preview` and Vitest are left alone. - It pre-bundles the package, so the first page load does not optimize it again and reload. - Start mode of `@solidjs/vite-plugin` serves no index.html and mounts the toolbar through its own entries, so the plugin adds nothing there. - `mount: false` keeps the plugin without the mount. - A second fixture renders no toolbar itself and uses the plugin. Its e2e tests check the mount and that a production build carries no toolbar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Adds
@solidjs/start-devtools/vite, a Vite plugin that mounts the toolbar duringvite dev, so an app served from anindex.htmlneeds no<DevToolbar>in its JSX. It is the first step toward devtools features that need the dev server, such as forwarding server-side diagnostics or an endpoint for agents.How it relates to
@solidjs/vite-pluginStart mode of
@solidjs/vite-pluginalready mounts the toolbar (src/devtools/index.tsand the generated entries insrc/ssr/index.tson itsnextbranch). Its plain mode mounts nothing. This plugin only covers the plain mode:transformIndexHtml. Start mode serves noindex.html, so the hook never runs there and the two plugins do not overlap.mountDevToolbar()returns the same dispose on a second call and skips the mount when a toolbar is already in the page, so an app that also rendersDevToolbarkeeps one toolbar.Whether devtools should take over the Start mode mount too is open for discussion. The server entry wraps the app in
DevToolbarso a server render error sets the 500 status, which a script tag cannot do.Changes
src/vite.ts: the plugin. It applies to the dev server only, so builds,vite previewand Vitest are left alone. It resolves the package from the app root, and pre-bundles it so the first page load does not optimize it again and reload.mount: falseturns the mount off../vite, built for Node intodist/vite.jswith its types.viteis an optional peer dependency.tests/fixture-viteis an app that renders no toolbar itself and uses the plugin. Playwright serves it beside the existing fixture.Testing
pnpm test,pnpm typecheck,pnpm format:check,pnpm build,pnpm checkand the full e2e suite pass locally.pnpm install --frozen-lockfilestill passes.🤖 Generated with Claude Code