forked from webpack/webpack
-
Notifications
You must be signed in to change notification settings - Fork 2
/
DelegatedPlugin.js
21 lines (19 loc) · 779 Bytes
/
DelegatedPlugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
MIT License http:https://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var DelegatedModuleFactoryPlugin = require("./DelegatedModuleFactoryPlugin");
var DelegatedSourceDependency = require("./dependencies/DelegatedSourceDependency");
function DelegatedPlugin(options) {
this.options = options;
}
module.exports = DelegatedPlugin;
DelegatedPlugin.prototype.apply = function(compiler) {
compiler.plugin("compilation", function(compilation, params) {
var normalModuleFactory = params.normalModuleFactory;
compilation.dependencyFactories.set(DelegatedSourceDependency, normalModuleFactory);
});
compiler.plugin("compile", function(params) {
params.normalModuleFactory.apply(new DelegatedModuleFactoryPlugin(this.options));
}.bind(this));
};