cmjoseph07/svelty-email

Compatibility with Svelte 5

Opened this issue · 2 comments

In svelte 5 trying to render email results in the following message:

Error: Component.render(...) is no longer valid in Svelte 5. See https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes for more information

Managed to get around this for now by wrapping the component passed to render with asClassComponent

e.g.

import { render } from 'svelty-email';
import { asClassComponent } from 'svelte/legacy';
import Hello from '$lib/emails/Hello.svelte';

const emailHtml = render({
	template: asClassComponent(Hello),
	props: {
		name: 'Svelte'
	}
});
Rar9 commented

is this approach better?
carstenlebek#34