Files
auth.andert.me/src/lib/core/componentLoader.ts
2023-07-28 12:50:30 +02:00

15 lines
520 B
TypeScript

import componentNames from 'virtual:components-list';
const components = {};
componentNames.forEach(path => {
// Ensure imports start with ./ or ../ and end with a file extension
const name = path.split('/').pop(); // Extract just the file name from the path
const componentPath = `../components/${path}.svelte`; // Update the path as per your file structure
// Suppress warning for dynamic import
components[name] = () => import(/* @vite-ignore */ componentPath);
});
export default components;