Fix build lags
This commit is contained in:
Vendored
+13
-3
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user