AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

[Turbopack] Excessive Fast Refresh Rebuilds When Dev Server Runs On Bun Runtime

When using Next.js dev with Turbopack under Bun (especially on Windows), a single file save triggers multiple Fast Refresh rebuild/done cycles. The number of cycles increases with project size and over time. Node+Turbopack and Bun+Webpack are unaffected.

highConfidence 75%Next.jsRoute HandlersServer ActionsReact Server ComponentsAffected V16.1.1Affected V16.1.4Affected V16.1.6

Origin Analysis

Bun's file watching on Windows emits multiple change events per file save (or due to event loop differences), and Next.js/Turbopack's HMR handler does not deduplicate/debounce these events, causing multiple rebuilds per save. This is a design gap in Next.js Turbopack's compatibility with Bun.
1. Create a minimal Next.js app. 2. Set dev script to `bun --bun next dev --turbopack`. 3. Run and open page. 4. Edit any component (e.g., src/app/page.tsx) and save. 5. Observe browser console: multiple [Fast Refresh] rebuilding/done pairs appear, sometimes increasing with project size and dev session duration.

Fixing Code Block

Edge Case Audit

防抖会延迟 HMR 更新 100ms,可能影响开发体验;如果两个独立文件在 100ms 内被保存,可能只有最后一次触发更新(漏掉前一次),但通常手动保存间隔较大,风险较低。在 Bun 1.3.8 上测试有效,但其他 Bun 版本或不同操作系统可能无效或需要调整延迟。若出现问题,删除补丁并重新安装 next 包回滚:`npm install` 会覆盖修改。等待 Next.js 官方修复;同时可尝试设置环境变量 `WATCHPACK_POLLING=true` 作为替代缓解。

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state