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

Commit

Permalink
refactor(HMR): rename module to path in context object (#787)
Browse files Browse the repository at this point in the history
* refactor: rename module to path parameter

* style: add a missing whitespace
  • Loading branch information
vchimev committed Feb 4, 2019
1 parent 5950e79 commit cc82df3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions bundle-config-loader.js
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
@@ -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
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
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
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 })}`;
};

0 comments on commit cc82df3

Please sign in to comment.