This commit is contained in:
Chris Wanstrath 2025-12-10 11:37:05 -08:00
parent 864adfa026
commit 8c3ac32578

View File

@ -98,13 +98,17 @@ export class Hype<
if (!path.endsWith('.js') && !path.endsWith('.ts')) path += '.ts'
const ts = path.replace('.js', '.ts')
if (await Bun.file(ts).exists()) {
if (await Bun.file(ts).exists())
return new Response(await transpile(ts), { headers: { 'Content-Type': 'text/javascript' } })
} else if (await Bun.file(path).exists()) {
else if (await Bun.file(ts + 'x').exists())
return new Response(await transpile(ts + 'x'), { headers: { 'Content-Type': 'text/javascript' } })
else if (await Bun.file(path).exists())
return new Response(Bun.file(path), { headers: { 'Content-Type': 'text/javascript' } })
} else {
else
return render404(c)
}
})
// file based routing