From 197db749b9238995baa43c1531498b826fb39de3 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Tue, 1 Sep 2026 17:29:34 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=83=88=20=ED=99=94=EB=A9=B4=EC=9D=98?= =?UTF-8?q?=20chunk=20=EC=9D=B4=EB=A6=84=EC=9D=84=20=ED=91=9C=EC=97=90=20?= =?UTF-8?q?=EB=84=A3=EA=B3=A0,=20=EB=B9=A0=EB=9C=A8=EB=A6=AC=EB=A9=B4=20?= =?UTF-8?q?=EB=A8=BC=EC=A0=80=20=EB=A9=88=EC=B6=94=EA=B2=8C=20=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit vite 설정이 화면 파일 → chunk 이름 표를 손으로 들고 있다. 주제 편집 화면을 더하고 이 표를 빠뜨렸더니 번들은 만들어지는데 빌드 매니페스트 단계에서 「Missing built route chunk」로 멈췄다 — 다섯 개의 검사를 다 통과한 뒤 배포 직전에야 드러난다는 뜻이다. 이 표도 손으로 나열한 목록 중 하나이므로 다섯 검사 안에서 대조한다. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_011nAjrqNHGPNngN4aUbcyvJ --- .../tech-log/route-chunk-names.test.ts | 30 +++++++++++++++++++ vite.config.ts | 3 ++ 2 files changed, 33 insertions(+) create mode 100644 tests/features/tech-log/route-chunk-names.test.ts diff --git a/tests/features/tech-log/route-chunk-names.test.ts b/tests/features/tech-log/route-chunk-names.test.ts new file mode 100644 index 0000000..9a71550 --- /dev/null +++ b/tests/features/tech-log/route-chunk-names.test.ts @@ -0,0 +1,30 @@ +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import { test } from "vitest"; + +import { TECH_LOG_ROUTE_RUNTIME_CONTRACT } from "../../../src/features/tech-log/contracts/tech-log-route-contract.ts"; + +/** + * 라우트마다 자기 chunk 이름이 있어야 한다. + * + *

vite 설정이 화면 파일 → chunk 이름 표를 손으로 들고 있다. 새 화면을 더하고 이 표를 + * 빠뜨리면 번들은 만들어지는데 빌드 매니페스트 단계에서 「Missing built route chunk」로 + * 멈춘다 — 다섯 개의 검사를 다 통과한 뒤 배포 직전에야 드러난다는 뜻이다. + * + *

여기서 미리 대조한다. 손으로 나열한 목록에 새 것을 빠뜨리는 일이 이 저장소에서 반복됐고, + * 이 표도 그중 하나다. + */ +const VITE_CONFIG = readFileSync("vite.config.ts", "utf8"); + +test("모든 라우트 모듈에 chunk 이름이 붙어 있다", () => { + const named = new Set( + [...VITE_CONFIG.matchAll(/"[^"]+":\s*"(route-[a-z0-9-]+)"/gu)].map((match) => match[1]!), + ); + assert.ok(named.size > 0, "vite 설정에서 chunk 이름을 하나도 읽지 못했다 — 표의 모양이 바뀌었다"); + + const missing = Object.values(TECH_LOG_ROUTE_RUNTIME_CONTRACT) + .map((runtime) => runtime.moduleId) + .filter((moduleId) => !named.has(moduleId)); + + assert.deepEqual(missing, [], `chunk 이름이 없는 라우트: ${missing.join(", ")}`); +}); diff --git a/vite.config.ts b/vite.config.ts index e202e45..d5e61da 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -34,6 +34,9 @@ const techLogRouteChunks = Object.freeze({ "/studio/pages/assets-page.tsx": "route-tech-log-studio-assets", "/studio/pages/taxonomy-page.tsx": "route-tech-log-studio-taxonomy", "/studio/pages/project-edit-page.tsx": "route-tech-log-studio-project-edit", + // 이 표를 빠뜨리면 빌드 매니페스트 단계에서 「Missing built route chunk」로 멈춘다. + // `route-chunk-names.test.ts` 가 다섯 검사 안에서 미리 대조한다. + "/studio/pages/topic-edit-page.tsx": "route-tech-log-studio-topic-edit", "/studio/pages/releases-page.tsx": "route-tech-log-studio-releases", "/studio/pages/release-edit-page.tsx": "route-tech-log-studio-release-edit", "/studio/pages/studio-not-found-page.tsx": "route-tech-log-studio-not-found",