You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{render}from'svelte/server';importSvelteTestCompfrom'./SvelteTestComp.svelte';const{ head, body }=render(SvelteTestComp,{props: {}});console.log('body',body);console.log('head',head);
Describe the bug
We've migrated a sizeable code base to the Svelte 5 compiler, while some components still use the legacy Svelte 4 syntax.
We've found a regression regarding the server side rendering of Svelte 4 components when
css: 'injected'
is used.Reproduction
Please see:
https://github.com/molily/svelte-server-test
Two components:
SvelteTestComp.svelte:
Note the
bind:hello
!Child.svelte:
SSR code in
node build-server.js
:build-server.js creates a SSR build with esbuild-svelte.
The output is written to
dist/
, it's already in the repo:https://github.com/molily/svelte-server-test/blob/main/dist/svelte-render-server.js
This output looks perfectly fine to me. The styles of both components are in the code:
So I assume the problem is not in esbuild-svelte.
Now, render SvelteTestComp using the bundle:
Output:
Note the missing
<style>
forChild
(with the blue border).What's causing this problem? We've managed to trace it back to
bind:hello
. 🤯Either remove it or change it to a non-binding prop passing
{hello}
, make a build, run the build.Output without
bind
:This is what I'm expecting in the
bind:hello
case as well. Am I missing anything?Thanks a lot for looking into this. Much appreciated.
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: