sveltekit-static-blog-template icon indicating copy to clipboard operation
sveltekit-static-blog-template copied to clipboard

Svelte 5 support

Open stopyransky opened this issue 5 months ago • 3 comments

So I had updated to svelte5 and the setup breaks with following error when parsing .md files with mdsvex

[vite] Error when evaluating SSR module /src/routes/(blog-articles)/+layout.server.ts: failed to import "/src/lib/data/blog-posts.ts"
|- Error: Component.render(...) is no longer valid in Svelte 5. See https://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes for more information
    at _page_md.render (.../src/routes/(blog-articles)/hello-blogging/+page.md:193:8)
    at Module.importPosts (...src/lib/utils/utils.ts:25:60)
    at .../src/lib/data/blog-posts.ts:3:25
    at async instantiateModule (.../node_modules/vite/dist/node/chunks/dep-BKbDVx1T.js:56231:9)

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:

import adapter from '@sveltejs/adapter-vercel';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import { mdsvex } from 'mdsvex';


/** @type {import('@sveltejs/kit').Config} */
const config = {

	extensions: ['.svelte', '.md'],
	preprocess: [
		vitePreprocess(),
		mdsvex({
			extensions: ['.md'],
		
		})
	],
	kit: {

		adapter: adapter()
	},
	vitePlugin:{

    dynamicCompileOptions({filename }){
      if(filename.includes('node_modules')) {
        return {
					customElement: true,
					runes: false
				}
      }
    }
  }

};

export default config;

stopyransky avatar Aug 29 '24 14:08 stopyransky