ExternalsPlugin.js 546 B

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