main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[79a0317] | 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 | /**
|
---|
| 14 | * @typedef {object} NodeTemplatePluginOptions
|
---|
| 15 | * @property {boolean} [asyncChunkLoading] enable async chunk loading
|
---|
| 16 | */
|
---|
| 17 |
|
---|
| 18 | class NodeTemplatePlugin {
|
---|
| 19 | /**
|
---|
| 20 | * @param {NodeTemplatePluginOptions} [options] options object
|
---|
| 21 | */
|
---|
| 22 | constructor(options = {}) {
|
---|
| 23 | this._options = options;
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | /**
|
---|
| 27 | * Apply the plugin
|
---|
| 28 | * @param {Compiler} compiler the compiler instance
|
---|
| 29 | * @returns {void}
|
---|
| 30 | */
|
---|
| 31 | apply(compiler) {
|
---|
| 32 | const chunkLoading = this._options.asyncChunkLoading
|
---|
| 33 | ? "async-node"
|
---|
| 34 | : "require";
|
---|
| 35 | compiler.options.output.chunkLoading = chunkLoading;
|
---|
| 36 | new CommonJsChunkFormatPlugin().apply(compiler);
|
---|
| 37 | new EnableChunkLoadingPlugin(chunkLoading).apply(compiler);
|
---|
| 38 | }
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | module.exports = NodeTemplatePlugin;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.