Skip to content

Commit 73650a5

Browse files
committed
Merge pull request webpack#404 from undoZen/module-hot-data
fix module.hot.data
2 parents 951d9ec + 112a44d commit 73650a5

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

lib/HotModuleReplacementPlugin.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ HotModuleReplacementPlugin.prototype.apply = function(compiler) {
137137
source + ",",
138138
"hot: hotCreateModule(" + varModuleId + "),",
139139
"parents: [hotCurrentParent],",
140-
"data: hotCurrentModuleData[" + varModuleId + "],",
141140
"children: []"
142141
]);
143142
});
@@ -273,7 +272,10 @@ var hotInitCode = Template.getFunctionContent(function() {
273272
removeStatusHandler: function(l) {
274273
var idx = hotStatusHandlers.indexOf(l);
275274
if(idx >= 0) hotStatusHandlers.splice(idx, 1);
276-
}
275+
},
276+
277+
//inherit from previous dispose call
278+
data: hotCurrentModuleData[moduleId]
277279
};
278280
return hot;
279281
}

lib/MainTemplate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function MainTemplate(outputOptions) {
4646
"",
4747
"// Create a new module (and put it into the cache)",
4848
"var module = installedModules[moduleId] = {",
49-
this.indent(this.applyPluginsWaterfall("module-obj", chunk, hash, "moduleId")),
49+
this.indent(this.applyPluginsWaterfall("module-obj", "", chunk, hash, "moduleId")),
5050
"};",
5151
"",
5252
"// Execute the module function",

0 commit comments

Comments
 (0)