QwikDev / QwikDev/qwik

[🐞] v2: building with bun (`bun run --bun build`) hangs indefinetly (but build seems ok)

Open
#8,373 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug router starters V2
Dominant language
TypeScript
Stars
22.1k
Forks
1.4k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

Which component is affected?

Starters / CLI

Describe the bug

When I create a new Qwik v2 project, add the bun or express.js adapter, and try to build with the bun runtime (bun run --bun build), it hangs at the Starting Qwik Router SSG...-step.
Manually cancelling the command and then running bun serve starts the server and the application serves the correct page, so the build seems to have worked.

I would have expected the command to exit after a successful build.

Reproduction

https://github.com/FloezeTv/qwik-bun-build-hang-reproduction

Steps to reproduce
  • Create new Qwik v2 beta project (bun create qwik@2.0.0-beta.23)
    • Empty Qwik App
  • Add bun-adapter and update to Qwik v2 version
    • bun run qwik add bun
    • curl https://raw.githubusercontent.com/QwikDev/qwik/refs/heads/build/v2/starters/adapters/bun/adapters/bun/vite.config.ts > adapters/bun/vite.config.ts
    • curl https://raw.githubusercontent.com/QwikDev/qwik/refs/heads/build/v2/starters/adapters/bun/src/entry.bun.ts > src/entry.bun.ts
  • Build using bun: bun run --bun build

The same hang is observed when adding expressjs adapter instead of bun; I have not tried other adapters.

System Info
System:
    OS: Linux 6.12 Manjaro Linux
    CPU: (16) x64 AMD Ryzen 7 5700U with Radeon Graphics
    Memory: 10.67 GB / 38.58 GB
    Container: Yes
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 25.4.0 - /usr/bin/node
    npm: 11.7.0 - /usr/bin/npm
    pnpm: 10.28.0 - /usr/bin/pnpm
    bun: 1.3.5 - /usr/bin/bun
    Deno: 2.6.5 - /usr/bin/deno
  Browsers:
    Firefox: 147.0.3
    Firefox Developer Edition: 147.0.3
  npmPackages:
    @qwik.dev/core: ^2.0.0-beta.23 => 2.0.0-beta.23 
    @qwik.dev/router: ^2.0.0-beta.23 => 2.0.0-beta.23 
    typescript: 5.9.3 => 5.9.3 
    vite: 7.3.1 => 7.3.1
Additional Information

This seems to be related to https://github.com/QwikDev/qwik/issues/5917#issuecomment-2117934513 and #6344.
I could not reproduce this in the latest v1-release.
A preview-build using bun also works without issues.
Commenting out the ssg-block in adapters/bun/vite.config.ts causes the command to output SSG results Duration: 49.7 ms and before the hang (but it still hangs).

This causes a build in the bun docker-container to hang as well; a workaround is to install nodejs in the build-step of the container so that the site is built using nodejs.
Serving the application using bun is fine.

Building with nodejs (bun run build) states that a hang was detected (SSG seems to be hanging after completion, forcing process to exit. Everything is likely fine.), but successfully exits after a short hang.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the hang with bun run --bun build in the linked reproduction, then inspect adapters/bun/vite.config.ts, especially its SSG block and the Starting Qwik Router SSG... step. Compare the Bun and Node build behavior; done means a successful Bun build exits without manual cancellation while still serving the correct page.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, typescript, vite
Domain
build-system, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.