You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
880 B

4 years ago
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const NodeMainTemplatePlugin = require("./NodeMainTemplatePlugin");
  7. const NodeChunkTemplatePlugin = require("./NodeChunkTemplatePlugin");
  8. const NodeHotUpdateChunkTemplatePlugin = require("./NodeHotUpdateChunkTemplatePlugin");
  9. class NodeTemplatePlugin {
  10. constructor(options) {
  11. options = options || {};
  12. this.asyncChunkLoading = options.asyncChunkLoading;
  13. }
  14. apply(compiler) {
  15. compiler.hooks.thisCompilation.tap("NodeTemplatePlugin", compilation => {
  16. new NodeMainTemplatePlugin(this.asyncChunkLoading).apply(
  17. compilation.mainTemplate
  18. );
  19. new NodeChunkTemplatePlugin().apply(compilation.chunkTemplate);
  20. new NodeHotUpdateChunkTemplatePlugin().apply(
  21. compilation.hotUpdateChunkTemplate
  22. );
  23. });
  24. }
  25. }
  26. module.exports = NodeTemplatePlugin;