fix(hmr): emit boot log at boot instead of the 1st livesync

This commit is contained in:
Igor Randjelovic
2022-06-07 17:47:22 +02:00
committed by Nathan Walker
parent c450d0ad2a
commit 5a00438321

View File

@ -5,6 +5,7 @@
if (module.hot) {
let hash = __webpack_require__.h();
let hmrBootEmittedSymbol = Symbol.for('HMRBootEmitted');
const logVerbose = (title: string, ...info: any) => {
if (__NS_ENV_VERBOSE__) {
@ -115,12 +116,15 @@ if (module.hot) {
return false;
}
await checkAndApply();
await originalOnLiveSync();
if (!global.hmrBootEmitted) {
global.hmrBootEmitted = true;
setStatus(hash, 'boot', 'HMR Enabled - waiting for changes...');
if (!(await checkAndApply())) {
return false;
}
await originalOnLiveSync();
};
if (!global[hmrBootEmittedSymbol]) {
global[hmrBootEmittedSymbol] = true;
setStatus(hash, 'boot', 'HMR Enabled - waiting for changes...');
}
}