2014-03-05 16:58:51 +08:00
|
|
|
/*
|
|
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
|
|
Author Tobias Koppers @sokra
|
|
|
|
*/
|
2015-05-13 06:15:01 +08:00
|
|
|
var ExternalModuleFactoryPlugin = require("./ExternalModuleFactoryPlugin");
|
2014-03-05 16:58:51 +08:00
|
|
|
|
|
|
|
function ExternalsPlugin(type, externals) {
|
|
|
|
this.type = type;
|
|
|
|
this.externals = externals;
|
|
|
|
}
|
|
|
|
module.exports = ExternalsPlugin;
|
|
|
|
ExternalsPlugin.prototype.apply = function(compiler) {
|
|
|
|
compiler.plugin("compile", function(params) {
|
2015-05-13 06:15:01 +08:00
|
|
|
params.normalModuleFactory.apply(new ExternalModuleFactoryPlugin(this.type, this.externals));
|
2014-03-05 16:58:51 +08:00
|
|
|
}.bind(this));
|
2015-05-13 06:15:01 +08:00
|
|
|
};
|