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;