feat: more readable error message for image not found
This commit is contained in:
		
							parent
							
								
									085fd62a79
								
							
						
					
					
						commit
						8beeba81db
					
				| 
						 | 
				
			
			@ -32,10 +32,11 @@ if (isLocal) {
 | 
			
		|||
  let normalizedPath = path
 | 
			
		||||
    .normalize(path.join('../../', basePath, src))
 | 
			
		||||
    .replace(/\\/g, '/')
 | 
			
		||||
  img = await files[normalizedPath]()
 | 
			
		||||
  if (!img) {
 | 
			
		||||
    console.error(`No image found for path ${normalizedPath}`)
 | 
			
		||||
  const file = files[normalizedPath]
 | 
			
		||||
  if (!file) {
 | 
			
		||||
    console.error(`\n[ERROR] Image file not found: ${normalizedPath.replace('../../', 'src/')}`)
 | 
			
		||||
  }
 | 
			
		||||
  img = await file()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const imageClass = 'w-full h-full object-cover'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue