Skip to content

Commit

Permalink
fix: missing html files for non blocking fallback page (#152)
Browse files Browse the repository at this point in the history
* fix: missing html files for non blocking fallback page

* Sync

---------

Co-authored-by: Frank <[email protected]>
  • Loading branch information
conico974 and fwang authored Jul 4, 2023
1 parent f40854b commit a468add
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/clever-waves-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"open-next": patch
---

Fix missing HTML files for non blocking fallback pages
8 changes: 7 additions & 1 deletion packages/open-next/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ function addPublicFilesList(outputPath: string, packagePath: string) {
function removeCachedPages(outputPath: string, packagePath: string) {
// Pre-rendered pages will be served out from S3 by the cache handler
const dotNextPath = path.join(outputPath, packagePath);
const isFallbackTruePage = /\[.*\]/;
const htmlPages = getHtmlPages(dotNextPath);
[".next/server/pages", ".next/server/app"]
.map((dir) => path.join(dotNextPath, dir))
Expand All @@ -508,7 +509,12 @@ function removeCachedPages(outputPath: string, packagePath: string) {
file.endsWith(".json") ||
file.endsWith(".rsc") ||
file.endsWith(".meta") ||
(file.endsWith(".html") && !htmlPages.has(file))
(file.endsWith(".html") &&
// do not remove static HTML files
!htmlPages.has(file) &&
// do not remove HTML files with "[param].html" format
// b/c they are used for "fallback:true" pages
!isFallbackTruePage.test(file))
)
);
}
Expand Down

1 comment on commit a468add

@vercel
Copy link

@vercel vercel bot commented on a468add Jul 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

open-next – ./

open-next-git-main-sst-dev.vercel.app
open-next-sst-dev.vercel.app
open-next.vercel.app

Please sign in to comment.