Bugfix. Fix esbuild post build function for HMR
This commit is contained in:
@@ -27,7 +27,9 @@ export default function () {
|
||||
|
||||
// await allPagesBunBundler();
|
||||
|
||||
await allPagesESBuildContextBundler();
|
||||
await allPagesESBuildContextBundler({
|
||||
post_build_fn: serverPostBuildFn,
|
||||
});
|
||||
|
||||
await startServer();
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@ let build_starts = 0;
|
||||
const MAX_BUILD_STARTS = 10;
|
||||
|
||||
type Params = {
|
||||
// post_build_fn?: (params: { artifacts: any[] }) => Promise<void> | void;
|
||||
post_build_fn?: (params: { artifacts: any[] }) => Promise<void> | void;
|
||||
// watch?: boolean;
|
||||
};
|
||||
|
||||
@@ -89,7 +89,7 @@ export default async function allPagesESBuildContextBundler(params?: Params) {
|
||||
}
|
||||
}
|
||||
|
||||
// params?.post_build_fn?.({ artifacts });
|
||||
params?.post_build_fn?.({ artifacts });
|
||||
|
||||
// writeFileSync(
|
||||
// HYDRATION_DST_DIR_MAP_JSON_FILE,
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { watch, existsSync } from "fs";
|
||||
import path from "path";
|
||||
import grabDirNames from "../../utils/grab-dir-names";
|
||||
import rebuildBundler from "./rebuild-bundler";
|
||||
import { log } from "../../utils/log";
|
||||
import allPagesESBuildContextBundler from "../bundler/all-pages-esbuild-context-bundler";
|
||||
import serverPostBuildFn from "./server-post-build-fn";
|
||||
|
||||
const { ROOT_DIR } = grabDirNames();
|
||||
|
||||
@@ -90,7 +92,9 @@ async function fullRebuild(params?: { msg?: string }) {
|
||||
await global.BUNDLER_CTX?.dispose();
|
||||
global.BUNDLER_CTX = undefined;
|
||||
|
||||
await allPagesESBuildContextBundler();
|
||||
await allPagesESBuildContextBundler({
|
||||
post_build_fn: serverPostBuildFn,
|
||||
});
|
||||
} catch (error: any) {
|
||||
log.error(error);
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user