1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | "use strict";
|
7 |
|
8 | const NodeMainTemplatePlugin = require("./NodeMainTemplatePlugin");
|
9 | const NodeChunkTemplatePlugin = require("./NodeChunkTemplatePlugin");
|
10 | const NodeHotUpdateChunkTemplatePlugin = require("./NodeHotUpdateChunkTemplatePlugin");
|
11 |
|
12 | class 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 |
|
31 | module.exports = NodeTemplatePlugin;
|