// Types
import type { PageLoad } from './$types'
async function importComponent(name: string) {
return import(`$lib/path/to/components/${name}.svelte`)
}
export const load = (async ({ data }) => {
const logos = data.website.companyLogos
const components = []
// We must import them here, in +page.ts, since we cannot serialize these components on the server
const componentModules = await Promise.all(logos.map((name: string) => importComponent(name)))
components.push(...componentModules.map((module) => module.default))
return { ...data, companyLogos: components }
}) satisfies PageLoad