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

feat(remix-serve): in manual mode, watch for changes to version.txt instead of server build #7470

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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/four-spies-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@remix-run/serve": patch
---

Fix error caused by partially written server build

Previously, it was possible to trigger a reimport of the app server code before the new server build had completely been written. Reimporting the partially written server build caused issues related to `build.assets` being undefined and crashing when reading `build.assets.version`.
3 changes: 2 additions & 1 deletion packages/remix-serve/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ async function run() {
}

let buildPath = path.resolve(buildPathArg);
let versionPath = path.resolve(buildPath, "..", "version.txt");

async function reimportServer() {
let stat = fs.statSync(buildPath);
Expand All @@ -60,7 +61,7 @@ async function run() {
}

chokidar
.watch(buildPath, { ignoreInitial: true })
.watch(versionPath, { ignoreInitial: true })
.on("add", handleServerUpdate)
.on("change", handleServerUpdate);

Expand Down