项目原始demo,不改动
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 

28 line
870 B

  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.plugin("this-compilation", (compilation) => {
  16. compilation.mainTemplate.apply(new NodeMainTemplatePlugin(this.asyncChunkLoading));
  17. compilation.chunkTemplate.apply(new NodeChunkTemplatePlugin());
  18. compilation.hotUpdateChunkTemplate.apply(new NodeHotUpdateChunkTemplatePlugin());
  19. });
  20. }
  21. }
  22. module.exports = NodeTemplatePlugin;