Skip to content

Commit f864b77

Browse files
authored
🪟 fix: Correctly Resolve Windows Path (#1)
* fix: use fileURLToPath for CLIENT_DIR to fix Windows ENOENT `new URL(...).pathname` produces `/C:/...` on Windows, which is an invalid filesystem path. `fileURLToPath()` correctly converts file URLs to platform-native paths. * refactor: use import.meta.dir + path.join for CLIENT_DIR Bun provides import.meta.dir as a native OS path, so path.join is the idiomatic way to build paths in a Bun-only entry file. * style: fix import order in server.ts
1 parent 244d2b9 commit f864b77

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎server.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Glob } from 'bun';
2+
import { join } from 'node:path';
23

3-
const CLIENT_DIR = new URL('./dist/client', import.meta.url).pathname;
4+
const CLIENT_DIR = join(import.meta.dir, 'dist', 'client');
45
const SERVER_ENTRY = new URL('./dist/server/server.js', import.meta.url);
56

67
type Handler = { default: { fetch: (req: Request) => Promise<Response> } };

0 commit comments

Comments
 (0)