Bugfix: update stale HMR after fixed errors

This commit is contained in:
2026-07-20 20:54:39 +01:00
parent e3a0f5fbeb
commit a9cd51d71c
14 changed files with 71 additions and 63 deletions
@@ -8,7 +8,9 @@ const { ROOT_DIR } = grabDirNames();
export default async function grabPageBundledReactComponent({ file_path, return_tsx_only, }) {
try {
if (global.SSR_BUNDLER_CTX_MAP?.[file_path]) {
const mod = await import(path.join(ROOT_DIR, global.SSR_BUNDLER_CTX_MAP[file_path].path));
const abs = path.join(ROOT_DIR, global.SSR_BUNDLER_CTX_MAP[file_path].path);
Loader.registry.delete(abs);
const mod = await import(`${abs}?t=${Date.now()}`);
const Main = mod.default;
return { component: Main };
}
@@ -16,6 +16,9 @@ export default async function grabPageCombinedServerRes({ file_path, debug, url,
const final_root_server_path = root_server_ctx_map?.local_path
? path.join(ROOT_DIR, root_server_ctx_map.path)
: root_server_file_path;
if (final_root_server_path) {
Loader.registry.delete(final_root_server_path);
}
const root_server_module = final_root_server_path
? await import(`${final_root_server_path}?t=${now}`)
: undefined;
@@ -34,6 +37,9 @@ export default async function grabPageCombinedServerRes({ file_path, debug, url,
const final_page_server_path = page_server_ctx?.local_path
? path.join(ROOT_DIR, page_server_ctx.path)
: server_file_path;
if (final_page_server_path) {
Loader.registry.delete(final_page_server_path);
}
const server_module = final_page_server_path
? await import(`${final_page_server_path}?t=${now}`)
: undefined;