Skip to content

fix: resolve Solid server builds for webworker SSR targets - #441

Merged
ryansolid merged 1 commit into
nextfrom
fix/153-ssr-webworker-conditions
Oct 21, 2026
Merged

ryansolid merged 1 commit into
nextfrom
fix/153-ssr-webworker-conditions

Conversation

@lxsmnsyc

Copy link
Copy Markdown
Member

Fixes #153 on next. The fix for main (1.x) is in a separate PR.

An SSR build with ssr.target: 'webworker' now bundles the server build of Solid. Before, it bundled the browser build, so isServer was false and renderToString threw.

Cause

  • With ssr.target: 'webworker', Vite gives the SSR environment the client resolve conditions.
  • Since Vite 6, the top-level resolve.conditions no longer reaches the SSR environment.
  • Solid's export maps put the server build under the worker condition.

Changes

  • The plugin adds worker to the SSR environment's conditions when it targets webworker.

Testing

  • Reproduced on Vite 8 with no user conditions and with the config from the issue. Both bundled the browser build. With the fix both bundle the server build.
  • Added a regression test that fails without the fix.
  • vitest run and tsc --noEmit pass.

🤖 Generated with Claude Code

- With ssr.target set to webworker, Vite gives the ssr environment the client conditions, so solid-js and @solidjs/web resolved to their browser builds and renderToString threw.
- Add the worker export condition to that environment. Solid maps worker to its server build.
- Add build tests for the webworker and node targets.

Fixes #153

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Oct 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c10fe96

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 19, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: c10fe96

@ryansolid
ryansolid merged commit 3343cbe into next Oct 21, 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