Skip to content

Fix @astrojs/solid-js prerender crash with Solid ecosystem packages (e.g. @kobalte/core) - #17584

Merged
matthewp merged 1 commit into
mainfrom
triagebot/fix-17583
Aug 3, 2026
Merged

matthewp merged 1 commit into
mainfrom
triagebot/fix-17583

Conversation

@astrobot-houston

Copy link
Copy Markdown
Contributor

Changes

  • Solid component libraries that ship pre-compiled browser artifacts via the exports.solid condition (e.g. @kobalte/core) were left external during prerendering. Node resolved them via the default condition instead, which picks up browser-only code that calls template() and other APIs stubbed with notSup() in solid-js/web/dist/server.js — crashing astro build with "Client-only API called on the server side".
  • Uses crawlFrameworkPkgs from vitefu to discover all packages that declare solid-js as a peer dependency, then adds them to resolve.noExternal for non-client environments (e.g. prerender). This forces Vite to bundle those packages so it can apply the solid export condition correctly, matching the established pattern from @astrojs/svelte (PR Fix .svelte files in node_modules with Cloudflare prerenderEnvironment: node #16210).
  • Adds vitefu to @astrojs/solid-js's dependencies (previously it was only available as a transitive dep via other packages).

Testing

No automated test added — configEnvironmentPlugin is internal and the solid integration has no existing test infrastructure for this; the svelte integration's equivalent fix also lacks a unit test. Fix was confirmed working by the reporter against both a minimal reproduction and a production project (12 pages).

Docs

No docs update needed — this restores expected build behavior with no API changes.

Closes #17583

Solid packages that ship pre-compiled browser artifacts via the
`exports.solid` condition (e.g. @kobalte/core) were left external
during prerendering, causing Node to resolve them via the `default`
condition and crash with "Client-only API called on the server side."

Use `crawlFrameworkPkgs` from `vitefu` to discover packages with a
`solid-js` peer dependency and add them to `resolve.noExternal` for
non-client environments, matching the approach used by @astrojs/svelte.

Fixes #17583
@changeset-bot

changeset-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8a486ea

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@astrojs/solid-js Patch
@e2e/errors Patch
@e2e/solid-circular Patch
@e2e/solid-component Patch
@e2e/solid-recurse Patch
@e2e/view-transitions Patch
@test/astro-slots-nested Patch
@test/large-array-solid Patch
@test/postcss Patch
@test/slots-solid Patch
@test/solid-component Patch
@test/astro-cloudflare-server-island-prerender-framework Patch
@test/astro-cloudflare-with-solid-js 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

@github-actions github-actions Bot added pkg: solid Related to Solid (scope) pkg: integration Related to any renderer integration (scope) labels Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

⚠️ Dependency Count

This PR adds 21 new dependencies (2142 → 2163), which exceeds the threshold of 10.

📊 Dependency Size Changes

Warning

This PR adds 5.2 MB of new dependencies, which exceeds the threshold of 100 kB.

📦 Package 📏 Size
@kobalte/core@0.13.12 3.7 MB
@swc/helpers@0.5.23 282.3 kB
@internationalized/number@3.6.7 237.4 kB
@kobalte/utils@0.9.2 235.4 kB
@floating-ui/core@1.8.0 218.6 kB
@floating-ui/dom@1.8.0 174.2 kB
@corvu/utils@0.4.2 84.5 kB
@floating-ui/utils@0.2.12 66.1 kB
@solid-primitives/utils@6.4.1 50.6 kB
@solid-primitives/event-listener@2.4.6 35.4 kB
@solid-primitives/rootless@1.5.4 24.1 kB
@solid-primitives/keyed@1.5.3 23.9 kB
@solid-primitives/props@3.2.4 21.9 kB
@solid-primitives/refs@1.1.4 19.8 kB
@solid-primitives/media@2.3.6 19.2 kB
solid-prevent-scroll@0.1.11 18.7 kB
@solid-primitives/map@0.4.13 17.8 kB
@solid-primitives/resize-observer@2.2.0 17.4 kB
@solid-primitives/static-store@0.1.4 14.3 kB
@solid-primitives/trigger@1.2.4 10.6 kB
solid-presence@0.1.8 10 kB

Total size change: 5.2 MB

@matthewp matthewp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow this is actually a pretty smart solution.

@matthewp
matthewp merged commit 5462b81 into main Aug 3, 2026
27 checks passed
@matthewp
matthewp deleted the triagebot/fix-17583 branch August 3, 2026 19:23
@astrobot-houston astrobot-houston mentioned this pull request Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix verified Reporter confirmed the triage bot fix works pkg: integration Related to any renderer integration (scope) pkg: solid Related to Solid (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prerendered pages crash when a Solid island imports kobalte (Client-only API called on the server side)

2 participants