Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit d032e4c

Browse files
author
Dimitar Tachev
authored
fix: stop ignoring the initial hot updates
1 parent 70d8545 commit d032e4c

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

Diff for: bundle-config-loader.ts

+7-11
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,22 @@ const loader: loader.Loader = function (source, map) {
3434
const hmr = `
3535
if (module.hot) {
3636
const hmrUpdate = require("nativescript-dev-webpack/hmr").hmrUpdate;
37-
global.__initialHmrUpdate = true;
38-
global.__hmrSyncBackup = global.__onLiveSync;
37+
global.__coreModulesLiveSync = global.__onLiveSync;
3938
4039
global.__onLiveSync = function () {
40+
// handle hot updated on LiveSync
4141
hmrUpdate();
4242
};
4343
4444
global.hmrRefresh = function({ type, path } = {}) {
45-
if (global.__initialHmrUpdate) {
46-
return;
47-
}
48-
45+
// the hot updates are applied, ask the modules to apply the changes
4946
setTimeout(() => {
50-
global.__hmrSyncBackup({ type, path });
47+
global.__coreModulesLiveSync({ type, path });
5148
});
5249
};
5350
54-
hmrUpdate().then(() => {
55-
global.__initialHmrUpdate = false;
56-
})
51+
// handle hot updated on initial app start
52+
hmrUpdate();
5753
}
5854
`;
5955

@@ -96,4 +92,4 @@ const loader: loader.Loader = function (source, map) {
9692
};
9793

9894

99-
export default loader;
95+
export default loader;

0 commit comments

Comments
 (0)