Skip to content

Import from SSR environment in Worker - #1

Merged
agcty merged 1 commit into
agcty:mainfrom
jamesopstad:use-ssr-environment
Mar 5, 2026
Merged

agcty merged 1 commit into
agcty:mainfrom
jamesopstad:use-ssr-environment

Conversation

@jamesopstad

Copy link
Copy Markdown
Contributor

This change adds an additional build input for the ssr environment and uses import.meta.viteRsc.loadModule to load from the ssr environment in the Worker.

@agcty
agcty merged commit a657cfa into agcty:main Mar 5, 2026
agcty added a commit to agcty/cloudflare-tools that referenced this pull request Jun 14, 2026
… pattern)

Adds a /worker-render endpoint that loads a custom "worker-ssr" module
from the ssr environment via loadModule("ssr", "worker-ssr") instead of
importing react-dom/server in the rsc worker entry — the blessed pattern
from agcty/vite-rsc-worker-env-repro#1. Proves the distilled plugin
handles: multiple ssr inputs (framework index + worker-ssr), the worker
loading a non-index ssr module cross-environment, and react-dom/server
resolving in the ssr child (it would fail under the rsc react-server
condition). Verified: GET /worker-render → 200 with rendered HTML; / still renders.
agcty added a commit to agcty/cloudflare-tools that referenced this pull request Jun 15, 2026
… pattern)

Adds a /worker-render endpoint that loads a custom "worker-ssr" module
from the ssr environment via loadModule("ssr", "worker-ssr") instead of
importing react-dom/server in the rsc worker entry — the blessed pattern
from agcty/vite-rsc-worker-env-repro#1. Proves the distilled plugin
handles: multiple ssr inputs (framework index + worker-ssr), the worker
loading a non-index ssr module cross-environment, and react-dom/server
resolving in the ssr child (it would fail under the rsc react-server
condition). Verified: GET /worker-render → 200 with rendered HTML; / still renders.
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