mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
fix: use Bun.main to detect compiled binary instead of Bun.isCompiled (#4)
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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
b953391737
commit
abe215d5d5
@@ -163,8 +163,8 @@ export async function startWebServer(options: {
|
||||
jwtSecret: Uint8Array
|
||||
socketEngine: SocketEngine
|
||||
}): Promise<BunServer<WebSocketData>> {
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user