getImage.ts 298 Bytes
 const getImage = (name :string, path: string) => {
    if (typeof name === 'undefined') return 'error.png'
    const fullPath = `/src/assets/images${path}/${name}`
    const modules = import.meta.globEager('/src/assets/images/*/*')
    return modules[fullPath]?.default
}
 export default getImage