Attempts to a broken dynamic service loading.

This commit is contained in:
2023-08-11 16:08:10 +02:00
parent 22545e46bb
commit 09304b9a95
9 changed files with 128 additions and 64 deletions

15
src/routes/+page.ts Normal file
View File

@@ -0,0 +1,15 @@
import type { PageLoad } from './$types';
export const load: PageLoad = async ({ data }) => {
for (const group of data.config.services) {
for (const service of group.items) {
const path =
'../lib/services/' + (service.componentPath || 'generic/GenericServiceCard.svelte');
const module = await import(/* @vite-ignore */ path);
service.component = module.default;
delete service.componentPath;
}
}
return { config: data.config };
};