Skip to content

Commit a468add

Browse files
conico974fwang
andauthored
fix: missing html files for non blocking fallback page (#152)
* fix: missing html files for non blocking fallback page * Sync --------- Co-authored-by: Frank <wangfanjie@gmail.com>
1 parent f40854b commit a468add

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.changeset/clever-waves-know.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"open-next": patch
3+
---
4+
5+
Fix missing HTML files for non blocking fallback pages

packages/open-next/src/build.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ function addPublicFilesList(outputPath: string, packagePath: string) {
497497
function removeCachedPages(outputPath: string, packagePath: string) {
498498
// Pre-rendered pages will be served out from S3 by the cache handler
499499
const dotNextPath = path.join(outputPath, packagePath);
500+
const isFallbackTruePage = /\[.*\]/;
500501
const htmlPages = getHtmlPages(dotNextPath);
501502
[".next/server/pages", ".next/server/app"]
502503
.map((dir) => path.join(dotNextPath, dir))
@@ -508,7 +509,12 @@ function removeCachedPages(outputPath: string, packagePath: string) {
508509
file.endsWith(".json") ||
509510
file.endsWith(".rsc") ||
510511
file.endsWith(".meta") ||
511-
(file.endsWith(".html") && !htmlPages.has(file))
512+
(file.endsWith(".html") &&
513+
// do not remove static HTML files
514+
!htmlPages.has(file) &&
515+
// do not remove HTML files with "[param].html" format
516+
// b/c they are used for "fallback:true" pages
517+
!isFallbackTruePage.test(file))
512518
)
513519
);
514520
}

0 commit comments

Comments
 (0)