Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit e8d40e1

Browse files
committed
Fix hmr
1 parent 90a1c99 commit e8d40e1

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

commands/dev.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ const handleHMRSocket = (req: Request): Response => {
5858
if (util.isFilledString(e.data)) {
5959
try {
6060
const { type, specifier } = JSON.parse(e.data);
61-
if ((type === "modify" || type === "hotUpdate") && util.isFilledString(specifier)) {
61+
if (type === "hotAccept" && util.isFilledString(specifier)) {
6262
emitter.on(
63-
type === "modify" ? `modify:${specifier}` : `hotUpdate:${specifier}`,
63+
`hotUpdate:${specifier}`,
6464
() => send({ type: "modify", specifier }),
6565
);
6666
}

framework/core/hmr.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Module {
4141
}
4242
};
4343
events.on("hmr:modify", handler);
44-
sendMessage({ specifier, type: "modify" });
44+
sendMessage({ specifier, type: "hotAccept" });
4545
return () => events.off("hmr:modify", handler);
4646
}
4747

@@ -138,9 +138,8 @@ function connect() {
138138
const mod = modules.get(specifier);
139139
if (mod) {
140140
mod.applyUpdate();
141-
} else {
142-
events.emit("hmr:modify", { specifier });
143141
}
142+
events.emit("hmr:modify", { specifier });
144143
break;
145144
}
146145
case "remove": {

0 commit comments

Comments
 (0)