Need to support Vite 4
billmcknight1953 opened this issue · 2 comments
Sveltekit is moving to be based on Vite 4. It seems that vite-plugin-markdown now needs to vite 2, 3 & 4 as possible dependencies
It's working for me in the latest version of svelte/kit
and vite
for the build itself. In dev mode I get errors while opening a page which requires markdown to be parsed.
It works though. The error causing code (in my application) is the import.meta.glob
in:
import { error } from '@sveltejs/kit'
export type JobPostings = Array<{
attributes: Record<string, string>
html: string
}>
/** @type {import('./$types').PageLoad} */
export async function load(): Promise<{ items: JobPostings }> {
try {
return {
items: JSON.parse(
JSON.stringify(
await Promise.all(
Object.values(import.meta.glob('$content/jobs/de/*.md')).map(file => file()),
),
),
),
}
} catch (error) {
console.error(error)
}
throw error(404, 'Not found')
}
For the time being you can install vite-plugin-markdown
with --force
, it will work, only the development seems to be affected.
I was able to use the plugin fine by adding the following to my package.json
:
{
"overrides": {
"vite-plugin-markdown": {
"vite": "$vite"
}
}
}
I did not see the same errors reported above in dev mode, but this might be because I use import.meta.glob
with { eager: true }
.