-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
Describe the bug
The following component:
<script lang="ts">
import MyComponent from './MyComponent.svelte';
</script>
<MyComponent>
<slot name="otherComponentSlot" slot="myComponentSlot" let:props {...props}></slot>
</MyComponent>is transformed into the following JS when using SSR:
/* OtherComponent.svelte generated by Svelte v4.2.0 */
import { create_ssr_component, validate_component } from "svelte/internal";
import MyComponent from './MyComponent.svelte';
const OtherComponent = create_ssr_component(($$result, $$props, $$bindings, slots) => {
return `${validate_component(MyComponent, "MyComponent").$$render($$result, {}, {}, {
myComponentSlot: () => {
return `${slots.otherComponentSlot
? slots.otherComponentSlot({ slot: "myComponentSlot", ...props })
: ``}`;
}
})}`;
});
export default OtherComponent;Note that the prop variable used in myComponentSlot is not defined anywhere, which results in a ReferenceError at runtime.
When using normal (browser not SSR) compilation, the component works fine as expected.
Reproduction
https://svelte.dev/repl/e9dad6e75c8041c1be79c2e07a82fc51?version=4.2.0
Logs
No response
System Info
Svelte v4.2.0Severity
annoyance
ExFlo, fbasso and quentinderoubaix
Metadata
Metadata
Assignees
Labels
No labels