Skip to content

fix(SSR): drop use client from components.server.ts#766

Open
mpesic wants to merge 1 commit into
stenciljs:mainfrom
mpesic:drop-server-use-client
Open

fix(SSR): drop use client from components.server.ts#766
mpesic wants to merge 1 commit into
stenciljs:mainfrom
mpesic:drop-server-use-client

Conversation

@mpesic
Copy link
Copy Markdown
Contributor

@mpesic mpesic commented Feb 24, 2026

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally for affected output targets
  • Tests (npm test) were run locally and passed
  • Prettier (npm run prettier) was run locally and passed

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Stencil-generated components.server.ts includes the use client directive.

Issue URL:

What is the new behavior?

components.server.ts executes in NodeJS environments and doesn't need the use client directive.

The use client confuses Vite into thinking that react-output-target/ssr package executes on the client.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@mpesic mpesic requested a review from a team as a code owner February 24, 2026 17:55
@Burzmalian
Copy link
Copy Markdown
Contributor

Any chance we can get this in? It is causing the hydrate script to be included in the client bundle for next.js

@davidpett davidpett force-pushed the drop-server-use-client branch from 236014b to 254492e Compare April 28, 2026 11:54
Copy link
Copy Markdown
Contributor

@davidpett davidpett left a comment

Choose a reason for hiding this comment

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

I have patched this into my project's codebase and it works as expected

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.

3 participants