fixed dynamic loader bug

This commit is contained in:
Samuel Andert
2023-07-29 13:21:53 +02:00
parent bdc3445a67
commit 414705e0b4
6 changed files with 157 additions and 157 deletions

View File

@ -3,12 +3,8 @@ 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);
const name = path.split('/').pop(); // Extract just the file name from the path
components[name] = () => import( /* @vite-ignore */ `/src/lib/components/${path}.svelte`);
});
export default components;
export default components;