Skip to content

fix: resolve production Solid builds under vite dev when dev is false - #405

Merged
ryansolid merged 4 commits into
nextfrom
fix/62-dev-false-production-runtime
Oct 9, 2026
Merged

ryansolid merged 4 commits into
nextfrom
fix/62-dev-false-production-runtime

Conversation

@brenelz

@brenelz brenelz commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Fixes #62.

With dev: false, vite dev still served Solid's development builds: the client pre-bundled solid-js/dist/solid.dev.js and @solidjs/web/dist/web.dev.js, and SSR loaded server.dev.js. The plugin already omits its own development condition in that case, but Vite's default conditions contain development|production, which resolves to development in any non-production mode. The documented behaviour ("Set to false to serve the production builds in dev instead") never took effect.

Changes

  • Under vite dev with dev: false, the plugin replaces the development|production entry with production in each environment's resolve.conditions. Vitest runs (mode test) and vite build keep Vite's default resolution.
  • With dev: false, the plugin no longer emits refresh wrappers or pre-bundles solid-js/refresh. The production refresh.js is an inert stub that warns on every call, so component edits now fall back to a full reload instead.
  • The diagnostics bridge (solid:diagnostics and the start entry's bridge import) now stays off with dev: false unless observe is on, because its channels exist only in the dev and observe builds.

Vite applies conditions to the whole environment, so with dev: false other packages that ship a development export also resolve their production builds under vite dev. Limiting the rewrite to Solid's packages would need custom resolution that also covers the dependency optimizer; I kept the environment-wide behaviour because dev: false is an explicit opt-in, and the changeset states it.

Verification

Scratch project with vite@8, solid-js@2.0.0-rc.14, @solidjs/web@2.0.0-rc.14 and this branch installed from pnpm pack:

  • server.environments.client.depsOptimizer.metadata with dev: false: solid-js <- dist/solid.js and @solidjs/web <- dist/web.js (before the change: solid.dev.js and web.dev.js). The default still bundles the dev builds.
  • server.environments.ssr.pluginContainer.resolveId('solid-js') with dev: false, ssr: true: dist/server.js (before: dist/server.dev.js).
  • resolveConfig with dev: false: conditions end in production for serve in development mode, and keep development|production for serve in test mode and for vite build.
  • Playwright Chromium against the dev server: the page logs DEV false with dev: false and DEV true by default. Editing a component hot-updates by default and full-reloads with dev: false, with no refresh-runtime warning.
  • With @solidjs/diagnostics installed, the bridge is injected by default, skipped with dev: false, and injected again with dev: false, observe: true.
  • tsc --noEmit and the rollup build pass.

🤖 Generated with Claude Code

@changeset-bot

changeset-bot Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0caf9f6

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 Oct 9, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 0caf9f6

ryansolid and others added 2 commits October 9, 2026 02:13
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@ryansolid ryansolid closed this Oct 9, 2026
@ryansolid ryansolid reopened this Oct 9, 2026
…uction-runtime

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	examples/ssr/package.json
@ryansolid
ryansolid merged commit f1ed4d4 into next Oct 9, 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