diff --git a/src/index.tsx b/src/index.tsx index 8ba2038..789cf96 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -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