Repository navigation
fix(vite): resolve Solid runtime dev builds from package exports - #11628
Merged
Merged
Conversation
Solid 2.0.0-rc.19 moved solid-js's dev build from dist/dev.js to dist/solid.dev.js and made it read DEV from @solidjs/signals at module load. The HMR pipeline hard-coded dist/dev.js (now a 404) and resolved @solidjs/signals without the development condition, so solid.dev.js paired with the signals prod build and threw reading DEV.guideUrl. Resolve the dev entry of solid-js, @solidjs/signals, @solidjs/universal and @solidjs/web from each package's exports map and pin bare imports, recorded boot paths, package-root URLs, the import map and the dev aliases to it. Solid 1.x and 2.0 rc.0 keep resolving to dist/dev.js; other flavors and packages are untouched.
|
View your CI Pipeline Execution ↗ for commit 4b207d7
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
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.
PR Checklist
What is the current behavior?
With
solid-js/@solidjs/*2.0.0-rc.19, an HMR dev session fails at boot:Two causes, both from Solid's rc.19 package layout:
@solidjs/signalsresolves to its prod build. The deps bundle, its root-URL shims, and the bare-import rewrite all resolve packages without thedevelopmentcondition, so@solidjs/signalslands ondist/prod/index.js, whereDEVisundefined. rc.19'ssolid.dev.jsreadsDEV.guideUrlat module load. (rc.0 also paired with prod signals, but nothing readDEVat load.)solid-js/dist/dev.jsno longer exists. The canonicalsolid-jsURL is hard-coded inrewrite-imports, the deps bundle (seed + routing), the Solid strategy's import map, andconfiguration/solid.ts. rc.19 renamed the file todist/solid.dev.js, so these URLs 404, and they diverge from thesolid.dev.jsURL other importers reach, which would load a second Solid instance.What is the new behavior?
helpers/solid-runtime.tsresolves the dev build of each Solid runtime package root (solid-js,@solidjs/signals,@solidjs/universal,@solidjs/web) from that package's ownexportsmap, preferring targets underdevelopment. All Solid pin sites use it:rewrite-imports: bare runtime roots rewrite to/ns/m/node_modules/<pkg>/<dev entry>.deps-bundle: the routing plugin, the vendor seed, recorded boot paths (an old recording containing/ns/m/node_modules/@solidjs/signalsno longer bundles prod), and package-root URL → shim lookup all go through oneresolveDepsSpecToFile.importMapEntries:solid-jsmaps to the resolved dev URL.configuration/solid.ts: in dev, aliases the runtime packages to their dev builds. Aliases are now anchored, so subpaths likesolid-js/internalreach the exports map instead of being prefix-matched to…/dist/dev.js/internal.Compatibility:
solid-js1.x and 2.0.0-rc.0 still resolve todist/dev.js. The exports maps of all three layouts are covered insolid-runtime.spec.ts.solid-jsfalls back to the legacydist/dev.js.developmentcondition is intentionally not enabled globally (see the conditions note inhmr/shared/vendor/manifest.tsaboutisServerstubs). Other flavors and non-Solid packages are unchanged.Verified against an rc.19 app:
solid.dev.js,signals/dist/dev.js,universal.dev.jsandsolid-js/dist/internal.js, with no prod Solid files./ns/m/node_modules/{solid-js,@solidjs/signals,@solidjs/universal}serve shims of those dev builds.solid-jspoints atdist/solid.dev.js, and app modules import the same URL. This holds with and without app-level Solid aliases.packages/vitesuite passes (166 files / 1943 tests), and the new deps-bundle test fails onmain.