This commit is contained in:
2026-09-22 16:07:09 +01:00
parent 1c52617728
commit 15eb1f7982
6 changed files with 49 additions and 54 deletions
+19 -2
View File
@@ -8,9 +8,27 @@ import serverPostBuildFn from "./server/server-post-build-fn";
import reactModulesBundler from "./bundler/react-modules-bundler";
import grabConstants from "../utils/grab-constants";
import watcherEsbuildCTX from "./server/watcher-esbuild-ctx";
import { readFileSync } from "fs";
const dirNames = grabDirNames();
const { PAGES_DIR } = dirNames;
const { PAGES_DIR, BUNDLER_CTX_MAP_JSON, SSR_BUNDLER_CTX_MAP_JSON } = dirNames;
export default async function bunextInit(params) {
const is_dev = isDevelopment();
if (!is_dev || params?.start) {
try {
const bundler_ctx_json = JSON.parse(readFileSync(BUNDLER_CTX_MAP_JSON, "utf-8"));
if (bundler_ctx_json) {
global.BUNEXT_BUNDLER_CTX_MAP = bundler_ctx_json;
}
}
catch (error) { }
try {
const ssr_bundler_ctx_json = JSON.parse(readFileSync(SSR_BUNDLER_CTX_MAP_JSON, "utf-8"));
if (ssr_bundler_ctx_json) {
global.BUNEXT_SSR_BUNDLER_CTX_MAP = ssr_bundler_ctx_json;
}
}
catch (error) { }
}
const are_modules_aready_built = global.BUNEXT_BUNDLER_CTX_MAP && global.BUNEXT_SSR_BUNDLER_CTX_MAP;
global.BUNEXT_HMR_CONTROLLERS = [];
if (!global.BUNEXT_BUNDLER_CTX_MAP) {
@@ -37,7 +55,6 @@ export default async function bunextInit(params) {
dir: PAGES_DIR,
});
global.BUNEXT_ROUTER = router;
const is_dev = isDevelopment();
if (params?.build_only) {
log.build(`Building Modules ...`);
await allPagesESBuildContextBundler({ build_only: params.build_only });