Last change
on this file since 84d0fbb was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
848 bytes
|
Line | |
---|
1 | /*
|
---|
2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
---|
3 | Author Tobias Koppers @sokra
|
---|
4 | */
|
---|
5 |
|
---|
6 | "use strict";
|
---|
7 |
|
---|
8 | const CommonJsChunkFormatPlugin = require("../javascript/CommonJsChunkFormatPlugin");
|
---|
9 | const EnableChunkLoadingPlugin = require("../javascript/EnableChunkLoadingPlugin");
|
---|
10 |
|
---|
11 | /** @typedef {import("../Compiler")} Compiler */
|
---|
12 |
|
---|
13 | class NodeTemplatePlugin {
|
---|
14 | constructor(options) {
|
---|
15 | this._options = options || {};
|
---|
16 | }
|
---|
17 |
|
---|
18 | /**
|
---|
19 | * Apply the plugin
|
---|
20 | * @param {Compiler} compiler the compiler instance
|
---|
21 | * @returns {void}
|
---|
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;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.