fixed vite error messages

This commit is contained in:
Samuel Andert
2023-07-28 12:50:30 +02:00
parent 4d310220dd
commit a4dec279dc
5 changed files with 11 additions and 9 deletions

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