Skip to content

fix: support top-level await in Bun fork container - #6168

Open
cestercian wants to merge 2 commits into
Unitech:masterfrom
cestercian:fix/bun-top-level-await
Open

cestercian wants to merge 2 commits into
Unitech:masterfrom
cestercian:fix/bun-top-level-await

Conversation

@cestercian

Copy link
Copy Markdown
Contributor

Bun fork mode was always loading the app with require(), so any ESM entry with top-level await would throw and restart-loop.

This mirrors the Node fork container: dynamic import for ESM, and require() falling back to import() when Bun reports an async module. Added a regression test with a top-level await fixture (skips when bun isn't on PATH).

Fixes #6162

@CLAassistant

CLAassistant commented Oct 7, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

ProcessContainerForkBun mirrors the Node fork container: use dynamic import
for ESM entries and fall back to import() when require() hits Bun's async
module error.

Fixes Unitech#6162
@cursor
cursor Bot force-pushed the fix/bun-top-level-await branch from 9c3462d to d00a5e6 Compare October 8, 2026 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bun fork container uses require(), so an ESM entry containing top-level await cannot start

2 participants