Skip to content

Commit 8dd3307

Browse files
committed
ensures the HMRPlugin assigns module.hot before NodeStuffPlugin
1 parent b545b51 commit 8dd3307

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎lib/HotModuleReplacementPlugin.js‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,12 @@ module.exports = class HotModuleReplacementPlugin {
191191
params.normalModuleFactory.plugin("parser", (parser, parserOptions) => {
192192
parser.plugin("expression __webpack_hash__", ParserHelpers.toConstantDependency("__webpack_require__.h()"));
193193
parser.plugin("evaluate typeof __webpack_hash__", ParserHelpers.evaluateToString("string"));
194-
parser.plugin("evaluate Identifier module.hot", function(expr) {
195-
return ParserHelpers.evaluateToIdentifier("module.hot", !!this.state.compilation.hotUpdateChunkTemplate)(expr);
196-
});
194+
parser.hooks.evaluateIdentifier.for("module.hot").tap({
195+
name: "HotModuleReplacementPlugin",
196+
before: "NodeStuffPlugin"
197+
}, expr => {
198+
return ParserHelpers.evaluateToIdentifier("module.hot", !!parser.state.compilation.hotUpdateChunkTemplate)(expr);
199+
});
197200
parser.plugin("call module.hot.accept", function(expr) {
198201
if(!this.state.compilation.hotUpdateChunkTemplate) return false;
199202
if(expr.arguments.length >= 1) {

0 commit comments

Comments
 (0)