Skip to content

Commit b362c22

Browse files
committed
Add dependencies when using loadModule
1 parent 424e162 commit b362c22

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/dependencies/LoaderPlugin.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,20 @@ LoaderPlugin.prototype.apply = function(compiler) {
2121
var dep = new LoaderDependency(request);
2222
compilation.addModuleDependencies(module, [[dep]], true, "lm", false, function(err, module) {
2323
if(err) return callback(err);
24-
24+
2525
if(!dep.module._source) throw new Error("The module created for a LoaderDependency must have a property _source");
2626
var map = dep.module._source.map();
2727
var source = dep.module._source.source();
28+
if(dep.module.fileDependencies) {
29+
dep.module.fileDependencies.forEach(function(dep) {
30+
loaderContext.addDependency(dep);
31+
});
32+
}
33+
if(dep.module.contextDependencies) {
34+
dep.module.contextDependencies.forEach(function(dep) {
35+
loaderContext.addContextDependency(dep);
36+
});
37+
}
2838
return callback(null, source, map, dep.module);
2939
});
3040
};

0 commit comments

Comments
 (0)