I'm trying to use Qwik city to build something like a blog using static files. I have a couple of reasons to not use .md/.mdx files in the routes directory and instead want to use a custom collection utility that loads Mdx files and generate dynamic routes from those files' paths which I do as follows:
export const onStaticGenerate: StaticGenerateHandler = async () => {
const parts = await loadPartsCollection()
return {
params: parts.map(part => ({ slug: part.slug }))
}
}
export const useRequestedPart = routeLoader$(async (requestEvent) => {
return loadPart(requestEvent.params.slug)
})
export default component$(() => {
const entry = useRequestedPart()
// ...
})
I've then written loadPart to return both the Mdx file's metadata/frontmatter, as well as "render" its content (like in this Github issue: https://github.com/QwikDev/qwik/issues/5100#issuecomment-1707498231 using imported.default().children). This works fine in dev mode, however I want to deploy the blog entirely using SSG and that throws a wrench into the generator. Because I return the rendered markdown, which is inherently non-serializable, I'm getting Qwik error code 3 "Only primitive and object literals can be serialized" and I can't seem to find a way around this