Attempts to a broken dynamic service loading.
This commit is contained in:
15
src/routes/+page.ts
Normal file
15
src/routes/+page.ts
Normal 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 };
|
||||
};
|
||||
Reference in New Issue
Block a user