1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | "use strict";
|
7 |
|
8 | const CommonJsChunkFormatPlugin = require("../javascript/CommonJsChunkFormatPlugin");
|
9 | const EnableChunkLoadingPlugin = require("../javascript/EnableChunkLoadingPlugin");
|
10 |
|
11 |
|
12 |
|
13 | class NodeTemplatePlugin {
|
14 | constructor(options) {
|
15 | this._options = options || {};
|
16 | }
|
17 |
|
18 | |
19 |
|
20 |
|
21 |
|
22 |
|
23 | apply(compiler) {
|
24 | const chunkLoading = this._options.asyncChunkLoading
|
25 | ? "async-node"
|
26 | : "require";
|
27 | compiler.options.output.chunkLoading = chunkLoading;
|
28 | new CommonJsChunkFormatPlugin().apply(compiler);
|
29 | new EnableChunkLoadingPlugin(chunkLoading).apply(compiler);
|
30 | }
|
31 | }
|
32 |
|
33 | module.exports = NodeTemplatePlugin;
|