Repository navigation
fix: resolve production Solid builds under vite dev when dev is false - #405
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 0caf9f6 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: |
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…uction-runtime Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # examples/ssr/package.json
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.
Fixes #62.
With
dev: false,vite devstill served Solid's development builds: the client pre-bundledsolid-js/dist/solid.dev.jsand@solidjs/web/dist/web.dev.js, and SSR loadedserver.dev.js. The plugin already omits its owndevelopmentcondition in that case, but Vite's default conditions containdevelopment|production, which resolves todevelopmentin any non-production mode. The documented behaviour ("Set tofalseto serve the production builds in dev instead") never took effect.Changes
vite devwithdev: false, the plugin replaces thedevelopment|productionentry withproductionin each environment'sresolve.conditions. Vitest runs (modetest) andvite buildkeep Vite's default resolution.dev: false, the plugin no longer emits refresh wrappers or pre-bundlessolid-js/refresh. The productionrefresh.jsis an inert stub that warns on every call, so component edits now fall back to a full reload instead.solid:diagnosticsand the start entry's bridge import) now stays off withdev: falseunlessobserveis on, because its channels exist only in the dev and observe builds.Vite applies conditions to the whole environment, so with
dev: falseother packages that ship adevelopmentexport also resolve their production builds undervite dev. Limiting the rewrite to Solid's packages would need custom resolution that also covers the dependency optimizer; I kept the environment-wide behaviour becausedev: falseis 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.14and this branch installed frompnpm pack:server.environments.client.depsOptimizer.metadatawithdev: false:solid-js <- dist/solid.jsand@solidjs/web <- dist/web.js(before the change:solid.dev.jsandweb.dev.js). The default still bundles the dev builds.server.environments.ssr.pluginContainer.resolveId('solid-js')withdev: false, ssr: true:dist/server.js(before:dist/server.dev.js).resolveConfigwithdev: false: conditions end inproductionfor serve in development mode, and keepdevelopment|productionfor serve in test mode and forvite build.DEV falsewithdev: falseandDEV trueby default. Editing a component hot-updates by default and full-reloads withdev: false, with no refresh-runtime warning.@solidjs/diagnosticsinstalled, the bridge is injected by default, skipped withdev: false, and injected again withdev: false, observe: true.tsc --noEmitand the rollup build pass.🤖 Generated with Claude Code