type IconComponents = { [key: string]: any }; const contextContent: any = import.meta.glob('./*.svg'); export const iconComponents: IconComponents = Object.keys(contextContent) .reduce((acc: any, path: any) => ({ ...acc, [getFileName(path)]: contextContent[path].default }), {}) as IconComponents; export const iconNames = Object.keys(iconComponents); function getFileName(url: string) { const chunk = url.split('/').pop() as string; return chunk.split('.')[0]; } export default { iconComponents, iconNames, };