12345678910111213141516171819202122
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. var ExternalModuleFactoryPlugin = require("./ExternalModuleFactoryPlugin");
  7. class ExternalsPlugin {
  8. constructor(type, externals) {
  9. this.type = type;
  10. this.externals = externals;
  11. }
  12. apply(compiler) {
  13. compiler.plugin("compile", (params) => {
  14. params.normalModuleFactory.apply(new ExternalModuleFactoryPlugin(this.type, this.externals));
  15. });
  16. }
  17. }
  18. module.exports = ExternalsPlugin;