Skip to content

Commit 2f60a24

Browse files
committed
fix(@angular/build): suppress asset missing warning for /index.html requests
Prevent incorrect warning display when the Service Worker requests `/index.html`. (cherry picked from commit f927879)
1 parent a70c3dc commit 2f60a24

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/angular/build/src/tools/vite/middlewares/html-fallback-middleware.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ export function angularHtmlFallbackMiddleware(
2828

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

0 commit comments

Comments
 (0)