Skip to content

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

@FloezeTv

Description

@FloezeTv

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 #5917 (comment) 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions