hotfix(v1.2): preview-404-fallback plugin の / と /privacy/ 404 副作用修正#200
Merged
Merged
Conversation
PR #199 の simpler approach(post-hook で未処理のみ届く前提)が誤り。 Vite 8.x の middleware 順序で indexHtmlMiddleware より前に動き、 全リクエストを飲み込むため / と /privacy/ も 404 化していた。 修正: 既存ファイル / ディレクトリ存在チェック追加 - dist/{url}(ファイル直接 or ディレクトリ)が存在 → next() で Vite に委譲 - dist/{url}/index.html が存在 → next() で Vite に委譲 - どちらも存在しない → 404.html を 404 ステータスで返す QC リトライで FAIL 検出 → 全 URL バリエーション(11件)動作確認で網羅性確保。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Deploying starter with
|
| Latest commit: |
2706338
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://5cf17fd1.starter-20t.pages.dev |
| Branch Preview URL: | https://hotfix-199-preview-404-fallb.starter-20t.pages.dev |
shunei-web
added a commit
that referenced
this pull request
May 4, 2026
#205) PR #199 / #200 で `vite.config.ts` の preview-404-fallback plugin は実装済 だったが、Issue #198 の完了条件「README または CONTRIBUTING に 404 動作明記」 が未完遂(PR body には記載があったが実 commit に含まれていなかった partial misreport)のため補完。 ## 変更内容 - README.md: 「ビルドと納品」末尾に「404 ページの動作確認」セクション追加。 本番ホスティング(Cloudflare Pages / Netlify / Vercel / GitHub Pages 共通) + ローカル preview + 直接アクセスの 3 確認パターンを記載。 - CONTRIBUTING.md: 「基本フロー」に `pnpm run preview` 動作確認手順を追加し、 README の該当節へリンク。 - CHANGELOG.md: Unreleased Added に preview-404-fallback plugin の動作を 追記(PR #199 / #200 で更新漏れ)。 ## 実機検証 `npm run build && npm run preview` 後の動作確認: | URL | 期待 | 実測 | |-----|------|------| | `/` | 200 | ✅ 200 | | `/privacy/` | 200 | ✅ 200 | | `/nonexistent` | 404 | ✅ 404 | | `/404.html`(直接) | 200 | ✅ 200 | | `/assets/notfound.css` | 404 | ✅ 404 | Closes #198
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.
概要
PR #199 で実装した
preview-404-fallbackplugin に副作用が発覚。QC リトライで検出。問題
//privacy//nonexistent根本原因
Vite の middleware 実行順:
PR #199 の実装は「post-hook は Vite 処理後の未処理のみ届く」前提だったが誤り。
カスタム middleware は indexHtmlMiddleware より前に動くため、存在チェックなしで全リクエストを飲み込んでいた。
修正内容
既存ファイル / ディレクトリ存在チェックを追加:
動作確認(全 11 URL)
//index.html/privacy//privacy/index.html/404.html/assets/main-BYe0Lm16.css/assets/main-1c-sa6K-.js/scripts/viewport.js/nonexistent/nonexistent/deep/nonexistentタイトルlint / build
pnpm run lint:js: PASSpnpm run lint:css: PASSpnpm run lint:html: PASSpnpm build: PASS関連
🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com