Skip to content

Commit 566a267

Browse files
committed
Log exceptions in requirePage when OPEN_NEXT_DEBUG=1
1 parent aef8e51 commit 566a267

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.changeset/fast-goats-fix.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@opennextjs/cloudflare": patch
3+
---
4+
5+
Log excpetions in requirePage when OPEN_NEXT_DEBUG=1

packages/cloudflare/src/cli/build/patches/plugins/dynamic-requires.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,16 @@ function requirePage($PAGE, $DIST_DIR, $IS_APP_PATH) {
135135
process.env.__NEXT_PRIVATE_RUNTIME_TYPE = $IS_APP_PATH ? 'app' : 'pages';
136136
try {
137137
${getRequires("pagePath", jsFiles, serverDir)}
138-
} finally {
138+
} ${
139+
buildOpts.debug
140+
? `
141+
catch (e) {
142+
console.error(e);
143+
throw e;
144+
}`
145+
: ``
146+
}
147+
finally {
139148
process.env.__NEXT_PRIVATE_RUNTIME_TYPE = '';
140149
}
141150
}`,

0 commit comments

Comments
 (0)