Fix build lags

This commit is contained in:
2026-10-02 14:48:38 +01:00
parent 17a5c3df01
commit 8fa5b64b48
38 changed files with 1390 additions and 1238 deletions
+13 -3
View File
@@ -62,11 +62,21 @@ export default async function bunextInit(params) {
}
else if (is_dev) {
log.build(`Building Modules ...`);
await allPagesESBuildContextBundler({
post_build_fn: async () => {
await serverPostBuildFn();
// Do NOT block on the full-site build: `Bun.serve` (or the start
// server) opens its port immediately and requests await
// BUNEXT_INITIAL_BUILD_PROMISE, so the site becomes reachable while
// the one-time compile still runs in the background.
const initial_build_promise = allPagesESBuildContextBundler({
post_build_fn: async (params) => {
await serverPostBuildFn(params);
},
});
global.BUNEXT_INITIAL_BUILD_PROMISE = initial_build_promise;
// Errors are logged (deduped) by the build pipeline itself; swallow
// the rejection here so it isn't an unhandled rejection.
initial_build_promise.catch(() => { });
// Start watching immediately so edits made during the initial build
// are not missed (rebuilds coalesce with the in-flight build).
watcherEsbuildCTX();
}
else {