chore: stop tracking next-env.d.ts, which every build rewrites - #862
Merged
Conversation
Both apps/website/next-env.d.ts and apps/cockpit/next-env.d.ts are generated by Next, and their contents differ by command: `next dev` writes an import of ./.next/dev/types/routes.d.ts, `next build` writes the Nx dist path. Tracking them means every build or dev run dirties the working tree, and the file flips back and forth depending on what ran last. I reverted that churn three times in one session before treating it as a problem. There is already a workaround for it — apps/website/scripts/run-e2e-with-next-env-restore.ts rewrites the file to hardcoded canonical content after e2e. Kept: with the file ignored the git churn is gone, but the script still prevents a stale dev-path reference from being left behind for a later typecheck in the same tree. Verified from a simulated fresh clone (both files absent, as they will be after this change): Website job: nx lint 0, nx test 0, nx build 0 Cockpit job: nx build 0, nx test 0 Both builds regenerate the file, so nothing downstream needs it committed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
blove
enabled auto-merge (squash)
August 30, 2026 01:33
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
apps/website/next-env.d.tsandapps/cockpit/next-env.d.tsare generated by Next, and their contents differ by command:So every build or dev run dirties the working tree, and the file flips back and forth depending on which ran last. I reverted that churn three times in a single session before treating it as a problem rather than noise.
There was already a workaround
apps/website/scripts/run-e2e-with-next-env-restore.tsexists solely to rewrite this file to hardcoded canonical content after e2e — evidence the churn has bitten before.Kept, deliberately. With the file ignored the git churn is gone, but the script still does something useful: it stops e2e from leaving behind a reference to a dev path that no longer exists, which a later typecheck in the same tree would trip over. Ignoring the file solves the VCS problem; the script solves the stale-content problem. Different problems.
Verified from a simulated fresh clone
The real risk is that both
tsconfig.jsonfiles listnext-env.d.tsininclude, so a checkout without it could break before any build runs. I tested that directly — removed both files and ran the exact CI sequences:nx lint→nx test→nx buildnx build→nx testBoth builds regenerate the file, so nothing downstream needs it committed.
One thing I ruled out along the way
Mid-investigation
nx build cockpitfailed, and it would have been easy to blame the deletion. It reproduces with the file restored — a Turbopack path error (leaves the filesystem root) caused by this worktree's depth inside the main repo, and only after a website build has populateddist/. Unrelated to this change, and it doesn't occur on a clean build.🤖 Generated with Claude Code