fix: 새 화면의 chunk 이름을 표에 넣고, 빠뜨리면 먼저 멈추게 한다

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

이 표도 손으로 나열한 목록 중 하나이므로 다섯 검사 안에서 대조한다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011nAjrqNHGPNngN4aUbcyvJ
This commit is contained in:
DongHyeonka
2026-09-01 17:29:34 +09:00
co-authored by Claude Opus 5
parent 77ef30420b
commit 197db749b9
2 changed files with 33 additions and 0 deletions
@@ -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 이름이 있어야 한다.
*
* <p>vite 설정이 화면 파일 → chunk 이름 표를 손으로 들고 있다. 새 화면을 더하고 이 표를
* 빠뜨리면 번들은 만들어지는데 빌드 매니페스트 단계에서 「Missing built route chunk」로
* 멈춘다 — 다섯 개의 검사를 다 통과한 뒤 배포 직전에야 드러난다는 뜻이다.
*
* <p>여기서 미리 대조한다. 손으로 나열한 목록에 새 것을 빠뜨리는 일이 이 저장소에서 반복됐고,
* 이 표도 그중 하나다.
*/
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(", ")}`);
});
+3
View File
@@ -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",