Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions bundle-config-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ module.exports = function (source) {
const hmr = `
if (module.hot) {
const hmrUpdate = require("nativescript-dev-webpack/hmr").hmrUpdate;
let initialHmrUpdate = true;
global.__initialHmrUpdate = true;
global.__hmrSyncBackup = global.__onLiveSync;

global.__onLiveSync = function () {
hmrUpdate();
};

global.__hmrRefresh = function({ type, module } = {}) {
if (initialHmrUpdate) {
global.hmrRefresh = function({ type, module } = {}) {
if (global.__initialHmrUpdate) {
return;
}

Expand All @@ -22,8 +22,8 @@ module.exports = function (source) {
});
};

hmrUpdate().then(() =>{
initialHmrUpdate = false;
hmrUpdate().then(() => {
global.__initialHmrUpdate = false;
})
}
`;
Expand Down
2 changes: 1 addition & 1 deletion demo/AngularApp/app/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (module["hot"]) {
module["hot"].accept(["./app.module"], () => {
// Currently the context is needed only for application style modules.
const moduleContext = {};
global["__hmrRefresh"](moduleContext);
global["hmrRefresh"](moduleContext);
});
}

Expand Down
2 changes: 1 addition & 1 deletion hot-loader-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports.reload = function ({ type, module }) {
if (module.hot) {
module.hot.accept();
module.hot.dispose(() => {
global.__hmrRefresh({ type: '${type}', module: '${module}' });
global.hmrRefresh({ type: '${type}', module: '${module}' });
})
}
`};
2 changes: 1 addition & 1 deletion lazy-ngmodule-hot-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const HOT_DISPOSE = `
module.hot.dispose(() => {
// Currently the context is needed only for application style modules.
const moduleContext = {};
global.__hmrRefresh(moduleContext);
global.hmrRefresh(moduleContext);
});`;
const HMR_HANDLER = `
if (module.hot) {
Expand Down