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

Commit bfa482a

Browse files
committed
refactor(HMR): refactor(HMR): unify snippet for different flavors
1 parent 1163f58 commit bfa482a

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

Diff for: bundle-config-loader.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ module.exports = function (source) {
66
if (module.hot) {
77
const hmrUpdate = require("nativescript-dev-webpack/hmr").hmrUpdate;
88
9-
global.__hmrLiveSync = global.__onLiveSync;
9+
global.__hmrSync = global.__onLiveSync;
1010
1111
global.__onLiveSync = function () {
12-
console.log("HMR: Sync...");
1312
hmrUpdate();
1413
};
1514
16-
// global.__hmrSync
1715
global.__hmrRefresh = function({ type, module }) {
1816
setTimeout(() => {
19-
global.__hmrLiveSync({ type, module });
17+
global.__hmrSync({ type, module });
2018
});
2119
};
20+
21+
global.__onLiveSync();
2222
}
2323
`;
2424

Diff for: demo/AngularApp/app/main.ts

-5
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,13 @@ import { AppModule } from "./app.module";
77
let options: AppOptions = {};
88

99
if (module["hot"]) {
10-
const hmrUpdate = require("nativescript-dev-webpack/hmr").hmrUpdate;
11-
1210
options.hmrOptions = {
1311
moduleTypeFactory: () => AppModule,
1412
livesyncCallback: (platformReboot) => {
15-
console.log("HMR livesyncCallback: Sync...")
1613
setTimeout(platformReboot, 0);
1714
},
1815
}
1916

20-
hmrUpdate();
21-
2217
// Path to your app module.
2318
// You might have to change it if your module is in a different place.
2419
module["hot"].accept(["./app.module"], global["__hmrRefresh"]);

0 commit comments

Comments
 (0)