LoaderTargetPlugin.js 480 B

123456789101112131415161718192021222324
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. class LoaderTargetPlugin {
  7. constructor(target) {
  8. this.target = target;
  9. }
  10. apply(compiler) {
  11. compiler.hooks.compilation.tap("LoaderTargetPlugin", compilation => {
  12. compilation.hooks.normalModuleLoader.tap(
  13. "LoaderTargetPlugin",
  14. loaderContext => {
  15. loaderContext.target = this.target;
  16. }
  17. );
  18. });
  19. }
  20. }
  21. module.exports = LoaderTargetPlugin;