Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't immediately exit on Pages Functions compilation error #671

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/tame-timers-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

Don't exit on initial Pages Functions compilation failure
GregBrimble marked this conversation as resolved.
Show resolved Hide resolved

Previously, we'd exit the `wrangler pages dev` process if we couldn't immediately compile a Worker from the `functions` directory. We now log the error, but don't exit the process. This means that proxy processes can be cleaned up cleanly on SIGINT and SIGTERM, and it matches the behavior of if a compilation error is introduced once already running (we don't exit then either).
16 changes: 9 additions & 7 deletions packages/wrangler/src/pages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -805,13 +805,15 @@ export const pages: BuilderCallback<unknown, unknown> = (yargs) => {

console.log(`Compiling worker to "${scriptPath}"...`);

await buildFunctions({
scriptPath,
functionsDirectory,
sourcemap: true,
watch: true,
onEnd: () => scriptReadyResolve(),
});
try {
await buildFunctions({
scriptPath,
functionsDirectory,
sourcemap: true,
watch: true,
onEnd: () => scriptReadyResolve(),
});
} catch {}
petebacondarwin marked this conversation as resolved.
Show resolved Hide resolved

watch([functionsDirectory], {
persistent: true,
Expand Down