This repository was archived by the owner on Sep 15, 2026. It is now read-only.
Repository navigation
chore(tsconfig): Next.js 16 がビルド時に書き換える設定を取り込む - #36
Merged
Merged
Conversation
`next build` on Next.js 16 rewrites `tsconfig.json` on every run, reporting:
The following mandatory changes were made to your tsconfig.json:
- jsx was set to react-jsx (next.js uses the React automatic runtime)
The following suggested values were added to your tsconfig.json:
- include was updated to add '.next/dev/types/**/*.ts'
so a clean checkout became dirty after any build, and the change had to be
discarded by hand each time. (`.next/dev` is new in 16: `next dev` and
`next build` now use separate output directories so they can run concurrently.)
Commit the two settings Next applies. Writing them by hand keeps the file in
Prettier's formatting — Next's own rewrite reformats every array onto multiple
lines, which would fight `prettier --check`.
Verified: after this change `next build` and `build-storybook` both leave
`tsconfig.json` untouched, and typecheck / lint / build / build-storybook all
pass.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
背景
#30 で Next.js 16 に上げて以降、
next buildを走らせるたびにtsconfig.jsonが書き換えられ、作業ツリーが汚れるようになっていました。
.next/devは Next 16 の新仕様です(next devとnext buildの出力先が分離され、同時実行できるようになった)。
変更
Next が適用してくる 2 つの設定を先にコミットしておきます。
"jsx": "preserve"→"jsx": "react-jsx"includeに.next/dev/types/**/*.tsを追加手で書いている理由: Next 自身の書き換えは全ての配列を複数行へ展開する整形も同時に行うため、
そのまま取り込むと
prettier --checkと衝突します。Prettier の整形を保ったまま意味的な差分だけを入れています。
確認
next build/build-storybookのどちらを走らせてもtsconfig.jsonが書き換わらないことを実際に確認(git diff --quietが通る)pnpm typecheck/pnpm lint/pnpm build/pnpm build-storybookすべて通過prettier --check tsconfig.json通過🤖 Generated with Claude Code