vercel / vercel/next.js

[Turbopack] Excessive Fast Refresh rebuilds when dev server runs on Bun runtime

Open
#89,530 12 comments 17 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

linear: next
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://github.com/MrScotch679/NextBunFastRefresh

To Reproduce

Environment

  • Next: 16.1.1
  • Bun: 1.3.8
  • OS: Windows
  • Dev command: bun --bun next dev --turbopack ...
  • Bundler: Turbopack
  • With Node runtime (node ./node_modules/next/dist/bin/next dev --turbopack): no issue
  • With Webpack (bun --bun next dev --webpack): no issue, but slower

Symptom

  • Single file save can trigger many [Fast Refresh] rebuilding / [Fast Refresh] done in … pairs in the browser console.
  • The number of cycles tends to grow over time and sometimes increases after page reload.

Expected: one BUILDING/BUILT pair per save (or at most a couple).

Actual: multiple pairs per save, with the count increasing on larger apps and over time.

Reproduction

Small app (minimal):

  1. Create a minimal Next app.
  2. In package.json set the dev script to bun --bun next dev --turbopack.
  3. Run bun run dev, open / in the browser.
  4. Edit src/app/page.tsx (e.g. add a space) and save.
  5. You may see more than one pair of [Fast Refresh] rebuilding / [Fast Refresh] done for that single save; on very small apps the behavior is not always stable.

Large app (stable repro):

  1. Use an App Router app (many modules/routes, global SCSS entry, next-intl with dynamic message imports, large barrel, layouts importing env and shared exports).
  2. Run bun --bun next dev --turbopack, open any page.
  3. Edit a single file and save.
  4. You should see multiple [Fast Refresh] rebuilding / done pairs (often 5 or more); after several such edits, the number of pairs per save tends to increase further.

Project characteristics

  • Even on small apps with Bun + Turbopack, a single save can produce multiple [Fast Refresh] rebuilding/done pairs.
  • On larger apps, the number of pairs per save increases markedly and can grow over the dev session.

What works / doesn’t

  • Node + Turbopack → OK
  • Bun + Webpack → OK (slower)
  • Bun + Turbopack → multiple BUILDING/BUILT (Fast Refresh) per change; effect worsens with project size.
Current vs. Expected behavior

Expected: one BUILDING/BUILT pair per save (or at most a couple).

Actual: multiple pairs per save, with the count increasing on larger apps and over time.

Provide environment information
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 65378
  Available CPU cores: 28
Binaries:
  Node: 22.14.0
  npm: 11.5.2
  Yarn: N/A
  pnpm: 10.11.0
Relevant Packages:
  next: 16.1.4 // There is a newer version (16.1.6) available, upgrade recommended!
  eslint-config-next: 15.5.4
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A
⚠ There is a newer version (16.1.6) available, upgrade recommended!
   Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
   Read more - https://nextjs.org/docs/messages/opening-an-issue
Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

Related

Bun: https://github.com/oven-sh/bun/issues/18113

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

Start with the linked NextBunFastRefresh reproduction, package.json, and the src/app/page.tsx edit described in the report. Run bun --bun next dev --turbopack and compare one save with Node + Turbopack and Bun + Webpack; done means a save produces one Fast Refresh rebuilding/done pair rather than repeated cycles.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, javascript, nextjs, react
Domain
build-system, devtools, frontend
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.