UNPKG

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