feat: more readable error message for image not found

This commit is contained in:
saicaca 2024-09-20 01:11:07 +08:00
parent 085fd62a79
commit 8beeba81db
1 changed files with 4 additions and 3 deletions

View File

@ -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'