/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/hotCases/universal/dev-server-client/index.js
26 строк
783 B
Alexander Akait
docs: add Hot Module Replacement examples for web, node and universal (#21222)
19 июн 2026, 13:54
Не верифицирован
19 июн 2026, 13:54
5ee4706
Код
Авторство
О чём код?
import value from "./module"; // universal regular-HMR client: works on web (dev-server EventSource signal) // and Node (same emitter signal) without a platform-specific client import emitter from "../../../../hot/emitter"; import "../../../../hot/dev-server"; import.meta.webpackHot.accept("./module"); it("should trigger HMR via the dev-server signal on web and node", (done) => { expect(value).toBe("value-1"); import.meta.webpackHot.accept("./module", () => { import("./module") .then((updated) => { expect(updated.default).toBe("value-2"); done(); }) .catch(done); }); NEXT((err, stats) => { if (err) return done(err); // emulate the dev-server pushing an update signal through the emitter emitter.emit("webpackHotUpdate", stats.hash); }); });