Skip to content

Commit 2758fb0

Browse files
authored
fix(build): call context.dispose() after first app is successfully built (npm#67)
1 parent 68a9090 commit 2758fb0

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/utils/build.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,15 @@ export async function* buildAndImportApp(
7979
})
8080

8181
await context.watch()
82-
if (!options.watch) {
83-
await context.dispose()
84-
}
8582

8683
do {
87-
yield await appPromise!
84+
const app = await appPromise!
85+
if (!options.watch) {
86+
// `context.dispose()` must be called after first build result to avoid race condition
87+
// https://github.com/honojs/cli/issues/66
88+
await context.dispose()
89+
}
90+
yield app
8891
preparePromise()
8992
} while (options.watch)
9093
}

0 commit comments

Comments
 (0)