From 51174c7e22e99e9845067815f353cc6fa2032244 Mon Sep 17 00:00:00 2001 From: alexander-akait Date: Tue, 25 Nov 2025 18:10:44 +0300 Subject: [PATCH] fix: compatibility with event target and universal target and lazy compilation --- client-src/index.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/client-src/index.js b/client-src/index.js index eeee5b717e..60527ef029 100644 --- a/client-src/index.js +++ b/client-src/index.js @@ -318,7 +318,22 @@ const reloadApp = ({ hot, liveReload }, currentStatus) => { if (hot && allowToHot) { log.info("App hot update..."); - hotEmitter.emit("webpackHotUpdate", currentStatus.currentHash); + if ( + typeof EventTarget !== "undefined" && + hotEmitter instanceof EventTarget + ) { + const event = new CustomEvent("webpackHotUpdate", { + detail: { + currentHash: currentStatus.currentHash, + }, + bubbles: true, + cancelable: false, + }); + + hotEmitter.dispatchEvent(event); + } else { + hotEmitter.emit("webpackHotUpdate", currentStatus.currentHash); + } if (typeof self !== "undefined" && self.window) { // broadcast update to window