Skip to content

Commit

Permalink
fix(@angular/build): suppress asset missing warning for /index.html
Browse files Browse the repository at this point in the history
… requests

Prevent incorrect warning display when the Service Worker requests `/index.html`.

(cherry picked from commit f927879)
  • Loading branch information
alan-agius4 committed Feb 14, 2025
1 parent a70c3dc commit 2f60a24
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ export function angularHtmlFallbackMiddleware(

if (req.url) {
const mimeType = lookupMimeTypeFromRequest(req.url);
if (mimeType === 'text/html' || mimeType === 'application/xhtml+xml') {
if (
(mimeType === 'text/html' || mimeType === 'application/xhtml+xml') &&
!/^\/index\.(?:csr\.)?html/.test(req.url)
) {
// eslint-disable-next-line no-console
console.warn(
`Request for HTML file "${req.url}" was received but no asset found. Asset may be missing from build.`,
Expand Down

0 comments on commit 2f60a24

Please sign in to comment.