source: frontend/node_modules/webpack/lib/dll/DelegatedPlugin.js

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

Fix frontend appearance

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[9af201e]1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8const DelegatedSourceDependency = require("../dependencies/DelegatedSourceDependency");
9const DelegatedModuleFactoryPlugin = require("./DelegatedModuleFactoryPlugin");
10
11/** @typedef {import("../Compiler")} Compiler */
12/** @typedef {import("./DelegatedModuleFactoryPlugin").Options} Options */
13
14const PLUGIN_NAME = "DelegatedPlugin";
15
16class DelegatedPlugin {
17 /**
18 * Creates an instance of DelegatedPlugin.
19 * @param {Options} options options
20 */
21 constructor(options) {
22 this.options = options;
23 }
24
25 /**
26 * Applies the plugin by registering its hooks on the compiler.
27 * @param {Compiler} compiler the compiler instance
28 * @returns {void}
29 */
30 apply(compiler) {
31 compiler.hooks.compilation.tap(
32 PLUGIN_NAME,
33 (compilation, { normalModuleFactory }) => {
34 compilation.dependencyFactories.set(
35 DelegatedSourceDependency,
36 normalModuleFactory
37 );
38 }
39 );
40
41 compiler.hooks.compile.tap(PLUGIN_NAME, ({ normalModuleFactory }) => {
42 new DelegatedModuleFactoryPlugin({
43 associatedObjectForCache: compiler.root,
44 ...this.options
45 }).apply(normalModuleFactory);
46 });
47 }
48}
49
50module.exports = DelegatedPlugin;
Note: See TracBrowser for help on using the repository browser.