Skip to content

Commit

Permalink
fix static 404 & 500 in page router (#422)
Browse files Browse the repository at this point in the history
* fix static 404 & 500 in page router

* fix package.json

* changeset
  • Loading branch information
conico974 authored May 24, 2024
1 parent 61066fe commit 1b3c6fe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/curly-points-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"open-next": patch
---

Fix static 404 and 500 in page router
2 changes: 1 addition & 1 deletion packages/open-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"access": "public"
},
"name": "open-next",
"version": "3.0.1-middleware-fix",
"version": "3.0.1",
"bin": {
"open-next": "./dist/index.js"
},
Expand Down
7 changes: 7 additions & 0 deletions packages/open-next/src/build/copyTracedFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ See the docs for more information on how to bundle edge runtime functions.
filesToCopy.set(f, f.replace(standaloneDir, outputDir));
});

if (!existsSync(path.join(standaloneNextDir, `${fullFilePath}`))) {
throw new Error(
`This error should only happen for static 404 and 500 page from page router. Report this if that's not the case.,
File ${fullFilePath} does not exist`,
);
}

filesToCopy.set(
path.join(standaloneNextDir, fullFilePath),
path.join(outputNextDir, fullFilePath),
Expand Down

0 comments on commit 1b3c6fe

Please sign in to comment.