use proper cwd

This commit is contained in:
Chris Wanstrath 2026-02-18 18:48:52 -08:00
parent f6da338b46
commit 4ff0727006

View File

@ -198,13 +198,13 @@ export class Hype<
const pageName = (c.req.param('page') ?? 'index').replace('.', '') const pageName = (c.req.param('page') ?? 'index').replace('.', '')
if (pageName.startsWith('_')) return render404(c) if (pageName.startsWith('_')) return render404(c)
const path = join(process.env.PWD ?? '.', `./src/pages/${pageName}.tsx`) const path = join(process.cwd(), `./src/pages/${pageName}.tsx`)
if (!(await Bun.file(path).exists())) if (!(await Bun.file(path).exists()))
return render404(c) return render404(c)
let Layout = defaultLayout let Layout = defaultLayout
const layoutPath = join(process.env.PWD ?? '.', `./src/pages/_layout.tsx`) const layoutPath = join(process.cwd(), `./src/pages/_layout.tsx`)
if (await Bun.file(layoutPath).exists()) { if (await Bun.file(layoutPath).exists()) {
Layout = pageCache.get(layoutPath) Layout = pageCache.get(layoutPath)
if (!Layout) { if (!Layout) {