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