Skip to content

Commit 4891225

Browse files
committed
Merge pull request webpack#470 from markmarijnissen/hmr-accept-multiple-deps-bugfix
bugfix HMR module.accept: resolve multiple deps to module ids
2 parents 70e361f + ec194ca commit 4891225

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/HotModuleReplacementPlugin.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,19 @@ HotModuleReplacementPlugin.prototype.apply = function(compiler) {
175175
compiler.parser.plugin("call module.hot.accept", function(expr) {
176176
if(!this.state.compilation.hotUpdateChunkTemplate) return false;
177177
if(expr.arguments.length > 1) {
178-
var param = this.evaluateExpression(expr.arguments[0]);
179-
if(param.isString()) {
178+
var arg = this.evaluateExpression(expr.arguments[0]);
179+
var params = [];
180+
if(arg.isString()) {
181+
params = [arg];
182+
}
183+
if(arg.isArray()){
184+
params = arg.items;
185+
}
186+
params.forEach(function(param){
180187
var dep = new ModuleHotAcceptDependency(param.string, param.range);
181188
dep.optional = true;
182189
this.state.module.addDependency(dep);
183-
}
190+
}.bind(this));
184191
}
185192
});
186193
compiler.parser.plugin("call module.hot.decline", function(expr) {

0 commit comments

Comments
 (0)