sveltejs / svelte · Issue No. 18607
A getter that returns a $derived declared later in the same scope compiles incorrectly for the server when that declaration has leading line comments: the comments are emitted between return and the value, so it gets turned it into return undefined. Minimal repro:
<script>
const ctx = {
get later() {
return later;
}
};
// a leading comment on the declaration
// that spans more than one line
const later = $derived.by(() => 'LATER');
</script>
https://svelte.dev/playground/8d84bcbde63248d79644a9343341451e?version=latest
You have to select generate: 'server'
If you set generate: 'client' it compiles correctly
No logs show up.
Svelte REPL with Svelte 5.56.8
annoyance
Relay reads this issue against the repository's contribution signals: the files it is likely to touch, how the maintainers triage work this size, and what the first contribution would exercise.
The full analysis for this issue is still being assembled. Until then, the description above and the thread on GitHub are the most reliable context.