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

refactor(HMR): rename module to path in context object #787

Merged
merged 2 commits into from
Feb 4, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions bundle-config-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ module.exports = function (source) {
hmrUpdate();
};

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

setTimeout(() => {
global.__hmrSyncBackup({ type, module });
global.__hmrSyncBackup({ type, path });
});
};

Expand Down
4 changes: 2 additions & 2 deletions hot-loader-helper.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports.reload = function ({ type, module }) {
module.exports.reload = function ({ type, path }) {
return `
if (module.hot) {
module.hot.accept();
module.hot.dispose(() => {
global.hmrRefresh({ type: '${type}', module: '${module}' });
global.hmrRefresh({ type: '${type}', path: '${path}' });
})
}
`};
2 changes: 1 addition & 1 deletion markup-hot-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ const { reload } = require("./hot-loader-helper");
module.exports = function (source) {
const typeMarkup = "markup";
const modulePath = this.resourcePath.replace(this.rootContext, ".");
return `${source};${reload({ type: typeMarkup, module: modulePath })}`;
return `${source};${reload({ type: typeMarkup, path: modulePath })}`;
};
2 changes: 1 addition & 1 deletion script-hot-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ const { reload } = require("./hot-loader-helper");
module.exports = function (source) {
const typeScript = "script";
const modulePath = this.resourcePath.replace(this.rootContext, ".");
return `${source};${reload({ type: typeScript, module: modulePath })}`;
return `${source};${reload({ type: typeScript, path: modulePath })}`;
};
2 changes: 1 addition & 1 deletion style-hot-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ const { reload } = require("./hot-loader-helper");
module.exports = function (source) {
const typeStyle = "style";
const modulePath = this.resourcePath.replace(this.rootContext, ".");
return `${source};${reload({ type: typeStyle, module: modulePath })}`;
return `${source};${reload({ type: typeStyle, path: modulePath })}`;
};