Refactor start and dev commands. Start in child processes. Handle errors better

This commit is contained in:
2026-04-17 08:47:36 +01:00
parent a5f25d522e
commit 9a427412f3
38 changed files with 706 additions and 224 deletions
@@ -7,9 +7,11 @@ import grabClientHydrationScript from "./grab-client-hydration-script";
import path from "path";
import virtualFilesPlugin from "./plugins/virtual-files-plugin";
import esbuildCTXArtifactTracker from "./plugins/esbuild-ctx-artifact-tracker";
const { HYDRATION_DST_DIR, BUNX_HYDRATION_SRC_DIR } = grabDirNames();
import { existsSync } from "fs";
const { HYDRATION_DST_DIR, BUNX_HYDRATION_SRC_DIR, BUNX_BUNDLER_ERROR_EXIT_FILE, } = grabDirNames();
export default async function allPagesESBuildContextBundler(params) {
try {
const did_process_exit_because_of_bundler_error = existsSync(BUNX_BUNDLER_ERROR_EXIT_FILE);
const pages = grabAllPages({ exclude_api: true });
global.PAGE_FILES = pages;
const dev = isDevelopment();
@@ -59,6 +61,9 @@ export default async function allPagesESBuildContextBundler(params) {
"react/jsx-runtime",
"react/jsx-dev-runtime",
],
logLevel: did_process_exit_because_of_bundler_error
? "silent"
: undefined,
});
await global.BUNDLER_CTX.rebuild();
}