From 8222180ff44336224c63b737243bc95a4c50a2a3 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Mon, 23 Mar 2026 23:19:58 -0700 Subject: [PATCH] Fix PWD env var usage and import path --- src/index.tsx | 4 ++-- src/tests/port-selection.test.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 1fb92d1..4cbe8a5 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -181,7 +181,7 @@ export class Hype< if (pageName.split('/').some(s => s.startsWith('_'))) return render404(c) // try pageName.tsx, then pageName/index.tsx - const base = join(process.cwd(), './src/pages') + const base = join(process.env.PWD ?? process.cwd(), './src/pages') let path = join(base, `${pageName}.tsx`) if (!(await Bun.file(path).exists())) { path = join(base, `${pageName}/index.tsx`) @@ -190,7 +190,7 @@ export class Hype< } let Layout = defaultLayout - const layoutPath = join(process.cwd(), `./src/pages/_layout.tsx`) + const layoutPath = join(process.env.PWD ?? process.cwd(), `./src/pages/_layout.tsx`) if (await Bun.file(layoutPath).exists()) { Layout = pageCache.get(layoutPath) if (!Layout) { diff --git a/src/tests/port-selection.test.ts b/src/tests/port-selection.test.ts index 2625ce3..016f8ee 100644 --- a/src/tests/port-selection.test.ts +++ b/src/tests/port-selection.test.ts @@ -1,5 +1,5 @@ import { test, expect } from "bun:test" -import { Hype } from "./index.tsx" +import { Hype } from "../index.tsx" test("defaults returns next available port in dev mode", () => { // Start a server on port 4000 to block it