nextjs - 💡(How to fix) Fix infinite rebuild hmr when rename middleware.ts to proxy.ts [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#85292Fetched 2026-04-08 02:16:32
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
closed ×1commented ×1issue_type_added ×1labeled ×1

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:41:50 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6030
  Available memory (MB): 36864
  Available CPU cores: 12
Binaries:
  Node: 22.17.1
  npm: 10.9.2
  Yarn: N/A
  pnpm: 10.14.0
Relevant Packages:
  next: 16.0.0 // Latest available version is detected (16.0.0).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.2
Next.js Config:
  output: standalone
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

cannot repro

To Reproduce

  1. run next dev with middleware.ts
  2. rename middleware.ts to proxy.ts
  3. next dev server rebuilds infinitely

Current vs. Expected behavior

Expected: should rebuild once Current: rebuild infinitely

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:41:50 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6030
  Available memory (MB): 36864
  Available CPU cores: 12
Binaries:
  Node: 22.17.1
  npm: 10.9.2
  Yarn: N/A
  pnpm: 10.14.0
Relevant Packages:
  next: 16.0.0 // Latest available version is detected (16.0.0).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.2
Next.js Config:
  output: standalone

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

No response

extent analysis

TL;DR

Renaming a file in the project triggers an infinite rebuild in the Next.js development server, suggesting a potential issue with file watching or caching.

Guidance

  • Verify if the issue persists when using a different file name or location to isolate if the problem is specific to the middleware.ts or proxy.ts name.
  • Check for any circular imports or dependencies that could be causing the infinite rebuild.
  • Try deleting the .next directory and restarting the development server to ensure it's not a caching issue.
  • Investigate if there are any known issues with file watching in Next.js version 16.0.0 or if there's an update available that addresses this problem.

Example

No specific code example is provided as the issue seems related to the development server's behavior rather than a specific code snippet.

Notes

The exact cause of the infinite rebuild is unclear without further information about the project's structure or the contents of middleware.ts. This issue might be specific to the combination of Next.js version, Node version, or the project's configuration.

Recommendation

Apply workaround: Try renaming the file to a different name that doesn't seem to trigger the infinite rebuild, or attempt to update Next.js to a newer version if available, to see if the issue persists. The reason is to avoid potential issues with the current file name or version incompatibilities.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING