Bugfix watcher function. Refresh bundler after adding and removing pages

This commit is contained in:
2026-03-17 16:20:58 +01:00
parent d56fe0ee55
commit c6166f5fd2
7 changed files with 60 additions and 98 deletions
+7 -4
View File
@@ -16,17 +16,20 @@ export default async function serverPostBuildFn({ artifacts }: Params) {
for (let i = 0; i < global.HMR_CONTROLLERS.length; i++) {
const controller = global.HMR_CONTROLLERS[i];
const target_artifact = artifacts.find(
(a) => controller.target_map.local_path == a.local_path,
);
if (!target_artifact?.local_path) continue;
const target_artifact = artifacts.find(
(a) => controller.target_map?.local_path == a.local_path,
);
const final_artifact: Omit<GlobalHMRControllerObject, "controller"> = {
..._.omit(controller, ["controller"]),
target_map: target_artifact,
};
if (!target_artifact) {
delete final_artifact.target_map;
}
try {
controller.controller.enqueue(
`event: update\ndata: ${JSON.stringify(final_artifact)}\n\n`,