bunext/dist/functions/server/rebuild-bundler.js
2026-03-23 07:42:00 +01:00

22 lines
715 B
JavaScript

import serverPostBuildFn from "./server-post-build-fn";
import { log } from "../../utils/log";
import allPagesBunBundler from "../bundler/all-pages-bun-bundler";
import cleanupArtifacts from "./cleanup-artifacts";
export default async function rebuildBundler(params) {
try {
global.ROUTER.reload();
// await global.BUNDLER_CTX?.dispose();
// global.BUNDLER_CTX = undefined;
const new_artifacts = await allPagesBunBundler({
page_file_paths: params?.target_file_paths,
});
await serverPostBuildFn();
if (new_artifacts?.[0]) {
cleanupArtifacts({ new_artifacts });
}
}
catch (error) {
log.error(error);
}
}