source: trip-planner-front/node_modules/webpack/lib/DelegatedPlugin.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1015 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
8const DelegatedModuleFactoryPlugin = require("./DelegatedModuleFactoryPlugin");
9const DelegatedSourceDependency = require("./dependencies/DelegatedSourceDependency");
10
11/** @typedef {import("./Compiler")} Compiler */
12
13class DelegatedPlugin {
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 compiler.hooks.compilation.tap(
25 "DelegatedPlugin",
26 (compilation, { normalModuleFactory }) => {
27 compilation.dependencyFactories.set(
28 DelegatedSourceDependency,
29 normalModuleFactory
30 );
31 }
32 );
33
34 compiler.hooks.compile.tap("DelegatedPlugin", ({ normalModuleFactory }) => {
35 new DelegatedModuleFactoryPlugin({
36 associatedObjectForCache: compiler.root,
37 ...this.options
38 }).apply(normalModuleFactory);
39 });
40 }
41}
42
43module.exports = DelegatedPlugin;
Note: See TracBrowser for help on using the repository browser.