source: frontend/node_modules/webpack/lib/node/NodeTemplatePlugin.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8const CommonJsChunkFormatPlugin = require("../javascript/CommonJsChunkFormatPlugin");
9const EnableChunkLoadingPlugin = require("../javascript/EnableChunkLoadingPlugin");
10
11/** @typedef {import("../Compiler")} Compiler */
12
13/**
14 * Represents the node template plugin runtime component.
15 * @typedef {object} NodeTemplatePluginOptions
16 * @property {boolean=} asyncChunkLoading enable async chunk loading
17 */
18
19class NodeTemplatePlugin {
20 /**
21 * Creates an instance of NodeTemplatePlugin.
22 * @param {NodeTemplatePluginOptions=} options options object
23 */
24 constructor(options = {}) {
25 /** @type {NodeTemplatePluginOptions} */
26 this._options = options;
27 }
28
29 /**
30 * Applies the plugin by registering its hooks on the compiler.
31 * @param {Compiler} compiler the compiler instance
32 * @returns {void}
33 */
34 apply(compiler) {
35 const chunkLoading = this._options.asyncChunkLoading
36 ? "async-node"
37 : "require";
38 compiler.options.output.chunkLoading = chunkLoading;
39 new CommonJsChunkFormatPlugin().apply(compiler);
40 new EnableChunkLoadingPlugin(chunkLoading).apply(compiler);
41 }
42}
43
44module.exports = NodeTemplatePlugin;
Note: See TracBrowser for help on using the repository browser.