Skip to content

Commit dd93716

Browse files
authored
Merge pull request #6296 from shellscape/fix/hmr-before-node-stuff
Ensure the HMRPlugin assigns module.hot before NodeStuffPlugin
2 parents 7a07901 + 90ab23a commit dd93716

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/HotModuleReplacementPlugin.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,10 @@ module.exports = class HotModuleReplacementPlugin {
203203
const handler = (parser, parserOptions) => {
204204
parser.hooks.expression.for("__webpack_hash__").tap("HotModuleReplacementPlugin", ParserHelpers.toConstantDependencyWithWebpackRequire(parser, "__webpack_require__.h()"));
205205
parser.hooks.evaluateTypeof.for("__webpack_hash__").tap("HotModuleReplacementPlugin", ParserHelpers.evaluateToString("string"));
206-
parser.hooks.evaluateIdentifier.for("module.hot").tap("HotModuleReplacementPlugin", expr => {
206+
parser.hooks.evaluateIdentifier.for("module.hot").tap({
207+
name: "HotModuleReplacementPlugin",
208+
before: "NodeStuffPlugin"
209+
}, expr => {
207210
return ParserHelpers.evaluateToIdentifier("module.hot", !!parser.state.compilation.hotUpdateChunkTemplate)(expr);
208211
});
209212
// TODO webpack 5: refactor this, no custom hooks

0 commit comments

Comments
 (0)