Skip to content

Commit 713533e

Browse files
committed
fixup: handle NodeModuleLoader
1 parent 964bf5a commit 713533e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,12 @@ rule:
9494
regex: ^NodeModuleLoader$
9595
fix: |
9696
async load($ID) {
97-
${getRequires("$ID", files, serverDir)}
97+
try {
98+
${getRequires("$ID", files, serverDir)}
99+
} catch (e) {
100+
${buildOpts.debug ? "console.error('Exception in NodeModuleLoader', e);" : ""}
101+
throw e;
102+
}
98103
}`;
99104
}
100105

@@ -139,7 +144,7 @@ function requirePage($PAGE, $DIST_DIR, $IS_APP_PATH) {
139144
buildOpts.debug
140145
? `
141146
catch (e) {
142-
console.error(e);
147+
console.error("Exception in requirePage", e);
143148
throw e;
144149
}`
145150
: ``

0 commit comments

Comments
 (0)