From abe215d5d5d3c65d2b7f9af3d9bcc127d76cf414 Mon Sep 17 00:00:00 2001 From: CherryLover Date: Thu, 25 Dec 2025 15:15:04 +0800 Subject: [PATCH] fix: use Bun.main to detect compiled binary instead of Bun.isCompiled (#4) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bun.isCompiled does not exist and always returns undefined, causing embeddedAssetMap to be null. This makes the server fall back to looking for web/dist directory, which doesn't exist when running the compiled binary from a different location. The correct way to detect a compiled Bun binary is to check if Bun.main starts with '/$bunfs' (the virtual filesystem path used by compiled binaries). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 --- server/src/web/server.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/web/server.ts b/server/src/web/server.ts index 9b2d53a7..b8343986 100644 --- a/server/src/web/server.ts +++ b/server/src/web/server.ts @@ -163,8 +163,8 @@ export async function startWebServer(options: { jwtSecret: Uint8Array socketEngine: SocketEngine }): Promise> { - const bunRuntime = (globalThis as typeof globalThis & { Bun?: { isCompiled?: boolean } }).Bun - const embeddedAssetMap = bunRuntime?.isCompiled ? await loadEmbeddedAssetMap() : null + const isCompiled = Bun.main?.startsWith('/$bunfs') ?? false + const embeddedAssetMap = isCompiled ? await loadEmbeddedAssetMap() : null const app = createWebApp({ getSyncEngine: options.getSyncEngine, getSseManager: options.getSseManager,