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

Commit cc82df3

Browse files
authored
refactor(HMR): rename module to path in context object (#787)
* refactor: rename module to path parameter * style: add a missing whitespace
1 parent 5950e79 commit cc82df3

5 files changed

+7
-7
lines changed

Diff for: bundle-config-loader.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ module.exports = function (source) {
1212
hmrUpdate();
1313
};
1414
15-
global.hmrRefresh = function({ type, module } = {}) {
15+
global.hmrRefresh = function({ type, path } = {}) {
1616
if (global.__initialHmrUpdate) {
1717
return;
1818
}
1919
2020
setTimeout(() => {
21-
global.__hmrSyncBackup({ type, module });
21+
global.__hmrSyncBackup({ type, path });
2222
});
2323
};
2424

Diff for: hot-loader-helper.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
module.exports.reload = function ({ type, module }) {
1+
module.exports.reload = function ({ type, path }) {
22
return `
33
if (module.hot) {
44
module.hot.accept();
55
module.hot.dispose(() => {
6-
global.hmrRefresh({ type: '${type}', module: '${module}' });
6+
global.hmrRefresh({ type: '${type}', path: '${path}' });
77
})
88
}
99
`};

Diff for: markup-hot-loader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ const { reload } = require("./hot-loader-helper");
33
module.exports = function (source) {
44
const typeMarkup = "markup";
55
const modulePath = this.resourcePath.replace(this.rootContext, ".");
6-
return `${source};${reload({ type: typeMarkup, module: modulePath })}`;
6+
return `${source};${reload({ type: typeMarkup, path: modulePath })}`;
77
};

Diff for: script-hot-loader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ const { reload } = require("./hot-loader-helper");
33
module.exports = function (source) {
44
const typeScript = "script";
55
const modulePath = this.resourcePath.replace(this.rootContext, ".");
6-
return `${source};${reload({ type: typeScript, module: modulePath })}`;
6+
return `${source};${reload({ type: typeScript, path: modulePath })}`;
77
};

Diff for: style-hot-loader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ const { reload } = require("./hot-loader-helper");
33
module.exports = function (source) {
44
const typeStyle = "style";
55
const modulePath = this.resourcePath.replace(this.rootContext, ".");
6-
return `${source};${reload({ type: typeStyle, module: modulePath })}`;
6+
return `${source};${reload({ type: typeStyle, path: modulePath })}`;
77
};

0 commit comments

Comments
 (0)