Skip to content

fix(boundary): allow client-only modules behind a lazy import - #2325

Open
lxsmnsyc wants to merge 1 commit into
mainfrom
fix/client-only-lazy-import
Open

lxsmnsyc wants to merge 1 commit into
mainfrom
fix/client-only-lazy-import

Conversation

@lxsmnsyc

Copy link
Copy Markdown
Member

A module marked client-only and loaded through clientOnly(() => import(...)) failed the server build. The server build resolves every dynamic import to emit its chunk, so it resolved the client-only module and errored, even though that module never runs on the server.

client-only now resolves to an empty module in both environments, so the lazy pattern builds and SSRs. Client-only code that does reach the server still fails there on its own. server-only is unchanged and still fails a client build.

A build-time check could not be kept: the resolve hook cannot tell a clientOnly() lazy import from a real server import, and throwing at eval time hangs the SSR stream instead of erroring cleanly.

Testing

  • Unit tests for the plugin updated; full package suite passes.
  • Verified in a production build: the lazy client-only pattern builds and SSRs 200 (was a build failure).
  • e2e suite passes, including the /client-only route.

🤖 Generated with Claude Code

A module marked `client-only` and loaded through `clientOnly(() => import(...))`
failed the server build. The server build resolves every dynamic import to
emit its chunk, so it resolved the client-only module and errored, even though
that module never runs on the server.

The resolve-time hook cannot tell a clientOnly() lazy import apart from a real
server import, and throwing at eval time instead hangs the SSR stream, so
`client-only` now resolves to an empty module in both environments. Client-only
code that does reach the server still fails there on its own. `server-only` is
unchanged and still fails a client build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Sep 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: afe53c4

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

This PR includes changesets to release 1 package
Name Type
@solidjs/start 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

@netlify

netlify Bot commented Sep 21, 2026

Copy link
Copy Markdown

Deploy Preview for solid-start-landing-page ready!

Name Link
🔨 Latest commit afe53c4
🔍 Latest deploy log https://app.netlify.com/projects/solid-start-landing-page/deploys/6ab0b9304e62a9000840bf58
😎 Deploy Preview https://deploy-preview-2325--solid-start-landing-page.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new

pkg-pr-new Bot commented Sep 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@solidjs/start@2325

commit: afe53c4

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.

1 participant