Skip to content
This repository was archived by the owner on Sep 15, 2026. It is now read-only.

chore(tsconfig): Next.js 16 がビルド時に書き換える設定を取り込む - #36

Merged
Uno-Takashi merged 1 commit into
mainfrom
chore/next16-tsconfig
Sep 15, 2026
Merged

Uno-Takashi merged 1 commit into
mainfrom
chore/next16-tsconfig

Conversation

@Uno-Takashi

Copy link
Copy Markdown
Member

背景

#30 で Next.js 16 に上げて以降、next build を走らせるたびに tsconfig.json が
書き換えられ、作業ツリーが汚れるようになっていました。

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'

.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

`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>
@Uno-Takashi
Uno-Takashi merged commit 3b702f8 into main Sep 15, 2026
7 checks passed
@Uno-Takashi
Uno-Takashi deleted the chore/next16-tsconfig branch September 15, 2026 07:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant