Open stopyransky opened 2 months ago
I haven't looked into Svelte 5 yet, so not sure if there's an alternative way of rendering the component.
Will look into this when I'm able!
Seems like the link in that error message (https://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes) has some alternatives. Feel free to try them out! I'm currently on vacation so won't be able to look into this for a bit
Yeah so in order to work for Svelte 5 there is a need to do an adjustment in $lib/utils importPosts
function so it uses render from svelte/server
, something like (I did not test it):
+ import { render } from 'svelte/server';
//...
// - export const importPosts = (render = false ) => {
export const importPosts = () => {
const blogImports = import.meta.glob('$routes/*/*/*.md', { eager: true });
const innerImports = import.meta.glob('$routes/*/*/*/*.md', { eager: true });
const imports = { ...blogImports, ...innerImports };
const posts: BlogPost[] = [];
for (const path in imports) {
const post = imports[path];
if (post) {
posts.push({
...post.metadata,
// html: render && post.default.render ? post.default.render()?.html : undefined,
+ html: render && post.default ? render(post.default)?.html : undefined,
});
}
}
return posts;
}
So I had updated to svelte5 and the setup breaks with following error when parsing .md files with mdsvex
it appears only when i try to visit .md blog post site. Any quick fix possible to make it work under Svelte5 ?
my svelte.config.js: