getCurrentVersion(); $path = $bundleService->getBundleFilePath($type, $kind, $version); if ($path !== '') { return $this->fileResponse($path, $mimeType, 31536000); } // 파일 경로가 비었다 — 병합 결과 자체가 비었거나, 디스크 캐시가 실패했다. $content = $bundleService->buildBundleContent($type, $kind); if ($content !== '') { // 디스크 캐시 실패 (2) — 메모리 결과로 서빙한다. 캐시 헤더는 붙이지 않는다: // 이 응답은 캐시에 실패한 상태의 산출물이라 다음 요청에서 정상 경로로 // 돌아갈 수 있어야 한다. return response($content, 200) ->header('Content-Type', $mimeType) ->header('Cache-Control', 'no-cache, private'); } $missing = $bundleService->findMissingDeclaredAssets($type, $kind); if ($missing !== []) { // (3) 장애 — 선언한 산출물이 소실·판독 불가 (배포 중 dist 가 잠깐 빔, 경로 어긋남). // 어느 파일이 없는지를 함께 남긴다 — 선언 수만으로는 운영자가 조치 대상을 짚을 수 없다. Log::error('확장 번들 병합 결과가 비었습니다 — 선언된 산출물이 없거나 읽을 수 없습니다', [ 'type' => $type, 'kind' => $kind, 'version' => $version, 'declared_extensions' => $bundleService->countAssetDeclaringExtensions($type, $kind), 'missing' => $missing, ]); return response('', 503) ->header('Content-Type', $mimeType) ->header('Cache-Control', 'no-cache, private'); } // (3) 정상 — 선언이 0 이거나, 선언된 산출물이 전부 존재하되 비어 있다 // (스타일이 비어 있는 확장). 빈 번들이 맞다. return response('', 200)->header('Content-Type', $mimeType); } }