File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
packages/vite/src/node/server/middlewares Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -466,12 +466,24 @@ export function indexHtmlMiddleware(
466
466
if ( ! content && fullBundleEnv . memoryFiles . size !== 0 ) {
467
467
return next ( )
468
468
}
469
+ const secFetchDest = req . headers [ 'sec-fetch-dest' ]
469
470
if (
470
- ( await fullBundleEnv . triggerBundleRegenerationIfStale ( ) ) ||
471
- content === undefined
471
+ [
472
+ 'document' ,
473
+ 'iframe' ,
474
+ 'frame' ,
475
+ 'fencedframe' ,
476
+ '' ,
477
+ undefined ,
478
+ ] . includes ( secFetchDest ) &&
479
+ ( ( await fullBundleEnv . triggerBundleRegenerationIfStale ( ) ) ||
480
+ content === undefined )
472
481
) {
473
482
content = await generateFallbackHtml ( server as ViteDevServer )
474
483
}
484
+ if ( ! content ) {
485
+ return next ( )
486
+ }
475
487
476
488
const html =
477
489
typeof content === 'string' ? content : Buffer . from ( content . buffer )
You can’t perform that action at this time.
0 commit comments