WebWorkerTemplatePlugin.js 783 B

1234567891011121314151617181920
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const WebWorkerMainTemplatePlugin = require("./WebWorkerMainTemplatePlugin");
  7. const WebWorkerChunkTemplatePlugin = require("./WebWorkerChunkTemplatePlugin");
  8. const WebWorkerHotUpdateChunkTemplatePlugin = require("./WebWorkerHotUpdateChunkTemplatePlugin");
  9. class WebWorkerTemplatePlugin {
  10. apply(compiler) {
  11. compiler.plugin("this-compilation", compilation => {
  12. compilation.mainTemplate.apply(new WebWorkerMainTemplatePlugin());
  13. compilation.chunkTemplate.apply(new WebWorkerChunkTemplatePlugin());
  14. compilation.hotUpdateChunkTemplate.apply(new WebWorkerHotUpdateChunkTemplatePlugin());
  15. });
  16. }
  17. }
  18. module.exports = WebWorkerTemplatePlugin;