Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit 1c9a2ff

Browse files
committed
Use template strings
1 parent 3b928ac commit 1c9a2ff

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

loader.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var extractTextPluginHmrRuntime = require.resolve("./hotModuleReplacement.js");
1414
module.exports = function(source) {
1515
if(this.cacheable) this.cacheable();
1616
// Even though this gets overwritten if extract+remove are true, without it, the runtime doesn't get added to the chunk
17-
return "if(module.hot){require('" + extractTextPluginHmrRuntime + "');}\n" + source;
17+
return `if (module.hot) { require('${extractTextPluginHmrRuntime}'); }\n${source}`;
1818
};
1919
module.exports.pitch = function(request) {
2020
if(this.cacheable) this.cacheable();
@@ -114,7 +114,13 @@ module.exports.pitch = function(request) {
114114
resultSource += "\nmodule.exports = " + JSON.stringify(text.locals) + ";";
115115
}
116116
// module.hot.data is undefined on initial load, and an object in hot updates
117-
resultSource += "\nif(module.hot){\nmodule.hot.accept();\nif(module.hot.data){\nrequire('" + extractTextPluginHmrRuntime + "')('%%extracted-hash%%','" + publicPath + "','%%extracted-file%%');\n}\n}";
117+
resultSource += `
118+
if (module.hot) {
119+
module.hot.accept();
120+
if (module.hot.data) {
121+
require('${extractTextPluginHmrRuntime}')('%%extracted-hash%%','${publicPath}','%%extracted-file%%');
122+
}
123+
}`;
118124
}
119125
} catch(e) {
120126
return callback(e);

0 commit comments

Comments
 (0)