Skip to content

Commit f927879

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`.
1 parent 87b310a commit f927879

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)