vercel / vercel/next.js

Webpack hot reloading stops working if projects is located in a folder starting with ".git"

Open
#75,372 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Webpack
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

Simply create a new project (see instructions below)

To Reproduce
  1. Create or navigate to a folder starting with .git (example .git-projects)
  2. Create a new project inside of it (example npx create-next-app@canary and select defaults)
  3. next dev (without --turbo)
  4. Open example page in browser
  5. Change src/app/page.tsx
  6. Observe no change
Current vs. Expected behavior

Current
If the parent folders of a nextjs application start with ".git", the webpack dev server (without --turbo) will not hot reload any changes made to the app.

Example paths of this might be:

  • /path/to/my/.git-projects/nextjs-app (this is my setup, which is how I found this in the first place)
  • /path/to/my/.git-projects/a/b/c/nextjs-app
  • /path/to/my/.git/nextjs-app

This is not an issue when using Turbopack.

Expected
Hot reloading should work.


I honestly don't expect this to be fixed, but I would love for others, who are facing a similar issue, to find this and spare them of multiple hours of wondering why this isn't working as expected.

Provide environment information
/bin/sh: pnpm: command not found

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:11 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6020
  Available memory (MB): 32768
  Available CPU cores: 12
Binaries:
  Node: 22.9.0
  npm: 10.8.3
  Yarn: 1.22.19
  pnpm: N/A
Relevant Packages:
  next: 15.2.0-canary.27 // Latest available version is detected (15.2.0-canary.27).
  eslint-config-next: 15.2.0-canary.27
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.3
Next.js Config:
  output: N/A
Which area(s) are affected? (Select all that apply)

Webpack

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

next dev (local)

Additional context

Was tested on @latest and @canary. Ignore the github repo, it is simply the default template of the current canary version.

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 issue with a Next.js app under a parent folder such as .git-projects, run next dev without --turbo, and edit src/app/page.tsx. Start by tracing the webpack hot-reload path used by next dev and compare it with the working Turbopack behavior. Done means edits to the example page update in the browser when the project is nested under a .git-prefixed path.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, next.js, typescript, webpack
Domain
developer-experience, frontend, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.