sveltejs / svelte

Cybernetically enhanced web apps
https://svelte.dev
MIT License
78.04k stars 4.08k forks source link

Svelte 5: cannot bind to a `<svelte:component/>` element #11984

Closed Ennoriel closed 2 months ago

Ennoriel commented 2 months ago

Describe the bug

It is not possible to bind a Svelte 4 props to a <svelte:component/> element:

<script>
  import Test from './Test.svelte'

  let div
</script>

<svelte:component this={Test} bind:div />

There is an error: "$$components is not defined".

This seems to be the cause of https://github.com/Ennoriel/svelte-awesome-color-picker/issues/75 For reference: Svelte 5: List of libraries not working out of the box https://github.com/sveltejs/svelte/issues/10359

Reproduction

https://svelte-5-preview.vercel.app/#H4sIAAAAAAAACo2OuwrCQBBFf2WYJk1I-jUK_oOdsdDsBAeyD3YnQQn5d3eNKGJjeYdz554Zex4oojrOaM-GUOHeeyxR7j6HONEglHJ0Y-jypYldYC-71rbCxrsgcKAo0AdnoKjqHKq1ViQmUQMJaJ5a29Sfrm1WRnUuPbFkBeTKcTvn_gIXtlqlEtQJTvPGae6ZNCoJIy3l2zbj_-kC0O2p-_LZfAn9bpyWB8l2UJMdAQAA

Logs

No response

System Info

REPL: running Svelte compiler version 5.0.0-next.152

Severity

blocking all usage of svelte

MotionlessTrain commented 2 months ago

I saw the error as well when I migrated Test to runes

The issue seems to be bind:div in the . Changing that to {div} gets rid of the error

Ennoriel commented 2 months ago

Thanks, that was quick!