I'd like to insert component dynamically. But, it fails. Could you someone please tell me about it and advice to solve this? REPL is here.
<script>
let Chatbox;
function loadChatbox() {
// this is available.
// import('./ChatBox.svelte').then(res => Chatbox = res.default)
// but, this is not. Why?? and How to make it??
const name = './ChatBox.svelte';
import(name).then(res => Chatbox = res.default)
}
</script>
<button on:click="{loadChatbox}">Load chatbox</button>
<svelte:component this="{Chatbox}" />