nextjs - ✅(Solved) Fix Next.js 16.0.1: next build and next dev generate different next-env.d.ts file [1 pull requests, 4 comments, 4 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#85738Fetched 2026-04-08 02:14:05
View on GitHub
Comments
4
Participants
4
Timeline
13
Reactions
4
Author
Assignees
Timeline (top)
commented ×4cross-referenced ×2labeled ×2assigned ×1

Fix Action

Fixed

PR fix notes

PR #47: Add next-env.d.ts to .gitignore

Description (problem / solution / changelog)

https://github.com/vercel/next.js/issues/85738#issuecomment-3482502616

Changed files

  • .gitignore (modified, +2/-1)
  • next-env.d.ts (removed, +0/-6)
  • package.json (modified, +1/-1)

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:41:45 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 10
Binaries:
  Node: 24.8.0
  npm: 11.6.0
  Yarn: 4.10.3
  pnpm: N/A
Relevant Packages:
  next: 16.0.1
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/mantinedev/next-app-template

To Reproduce

  1. Clone the repository and install dependencies
  2. run npm run dev
  3. See that next-env.d.ts file changed
  4. run npm run build
  5. See that next-env.d.ts file changed again

As I understood, the next-env.d.ts file must be commited to the vcs and it changing depending on the script might polute the git history.

Current vs. Expected behavior

Current behavior: The next-env.d.ts file changes depending on whether next build or next dev script. Expected behavior: (same as prior Next.js 16) next-env.d.ts file does not change depending on the script.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:41:45 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 10
Binaries:
  Node: 24.8.0
  npm: 11.6.0
  Yarn: 4.10.3
  pnpm: N/A
Relevant Packages:
  next: 16.0.1
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A

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

Turbopack

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

next dev (local)

Additional context

Information with more details here – https://github.com/mantinedev/next-app-template/issues/46

extent analysis

TL;DR

The next-env.d.ts file changing depending on the script run can be mitigated by excluding it from version control or using a consistent build process.

Guidance

  • Review the .gitignore file to ensure it does not include next-env.d.ts, and consider adding it to prevent unnecessary changes in the Git history.
  • Check the next.config.js file for any configurations that might be causing the next-env.d.ts file to change between next dev and next build scripts.
  • Investigate the differences in the next-env.d.ts file changes between the two scripts to understand the root cause of the inconsistency.
  • Consider using a consistent build process or a script that normalizes the next-env.d.ts file before committing it to version control.

Example

No specific code example is provided as the issue is more related to the build process and version control rather than a specific code snippet.

Notes

The provided information suggests that the issue is related to the new behavior in Next.js 16, and the expected behavior is the same as in prior versions. However, without more details about the specific changes in the next-env.d.ts file, it's difficult to provide a more targeted solution.

Recommendation

Apply workaround: Exclude next-env.d.ts from version control by adding it to .gitignore to prevent unnecessary changes in the Git history. This will help maintain a consistent state of the file across different scripts and environments.

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