non-blocking docs load

This commit is contained in:
vcoppe
2024-09-20 14:22:55 +02:00
parent a48da3fcf0
commit f77793b7fe
7 changed files with 54 additions and 48 deletions

View File

@@ -1,19 +1,14 @@
async function getModule(language: string | undefined, guide: string) {
function getModule(language: string | undefined, guide: string) {
language = language ?? 'en';
return await import(`./../../lib/docs/${language}/home/${guide}.mdx`);
return import(`./../../lib/docs/${language}/home/${guide}.mdx`);
}
export async function load({ params }) {
const { language } = params;
const fundingModule = await getModule(language, 'funding');
const translationModule = await getModule(language, 'translation');
const mapboxModule = await getModule(language, 'mapbox');
return {
fundingComponent: fundingModule.default,
translationComponent: translationModule.default,
mapboxComponent: mapboxModule.default,
fundingModule: getModule(language, 'funding'),
translationModule: getModule(language, 'translation'),
mapboxModule: getModule(language, 'mapbox'),
};
}