added dynamical import of components via vite

This commit is contained in:
Samuel Andert
2023-07-22 09:29:40 +02:00
parent 01c742e6ce
commit 1ba7a9a28b
7 changed files with 53 additions and 69 deletions

View File

@ -4,9 +4,8 @@
export let name = '';
async function getComponent(componentName) {
if (components[componentName]) return components[componentName];
if (componentName === 'Composite') {
const module = await import('$lib/components/Composite.svelte');
if (components[componentName]) {
const module = await components[componentName]();
return module.default;
}
return null;
@ -26,5 +25,3 @@
{/if}
{/await}
{/each}
<p>Composite: {name}</p>