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'); } $declared = $bundleService->countAssetDeclaringExtensions($type, $kind); if ($declared > 0) { // (3) 장애 — 선언은 있는데 결과가 0 Log::error('확장 번들 병합 결과가 비었습니다 — 에셋을 선언한 활성 확장이 있습니다', [ 'type' => $type, 'kind' => $kind, 'version' => $version, 'declared_extensions' => $declared, ]); return response('', 503) ->header('Content-Type', $mimeType) ->header('Cache-Control', 'no-cache, private'); } // (3) 정상 — 선언이 0개면 빈 번들이 맞다 return response('', 200)->header('Content-Type', $mimeType); } }