main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
1.1 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 |
|
---|
8 | const DelegatedModuleFactoryPlugin = require("./DelegatedModuleFactoryPlugin");
|
---|
9 | const DelegatedSourceDependency = require("./dependencies/DelegatedSourceDependency");
|
---|
10 |
|
---|
11 | /** @typedef {import("./Compiler")} Compiler */
|
---|
12 | /** @typedef {import("./DelegatedModuleFactoryPlugin").Options} Options */
|
---|
13 |
|
---|
14 | class DelegatedPlugin {
|
---|
15 | /**
|
---|
16 | * @param {Options} options options
|
---|
17 | */
|
---|
18 | constructor(options) {
|
---|
19 | this.options = options;
|
---|
20 | }
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * Apply the plugin
|
---|
24 | * @param {Compiler} compiler the compiler instance
|
---|
25 | * @returns {void}
|
---|
26 | */
|
---|
27 | apply(compiler) {
|
---|
28 | compiler.hooks.compilation.tap(
|
---|
29 | "DelegatedPlugin",
|
---|
30 | (compilation, { normalModuleFactory }) => {
|
---|
31 | compilation.dependencyFactories.set(
|
---|
32 | DelegatedSourceDependency,
|
---|
33 | normalModuleFactory
|
---|
34 | );
|
---|
35 | }
|
---|
36 | );
|
---|
37 |
|
---|
38 | compiler.hooks.compile.tap("DelegatedPlugin", ({ normalModuleFactory }) => {
|
---|
39 | new DelegatedModuleFactoryPlugin({
|
---|
40 | associatedObjectForCache: compiler.root,
|
---|
41 | ...this.options
|
---|
42 | }).apply(normalModuleFactory);
|
---|
43 | });
|
---|
44 | }
|
---|
45 | }
|
---|
46 |
|
---|
47 | module.exports = DelegatedPlugin;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.