MCPcopy
hub / github.com/webpack/webpack / apply

Method apply

lib/EntryPlugin.js:35–54  ·  lib/EntryPlugin.js::EntryPlugin.apply

* Applies the plugin by registering its hooks on the compiler. * @param {Compiler} compiler the compiler instance * @returns {void}

(compiler)

Source from the content-addressed store, hash-verified

33 * @returns {void}
34 */
35 apply(compiler) {
36 compiler.hooks.compilation.tap(
37 PLUGIN_NAME,
38 (compilation, { normalModuleFactory }) => {
39 compilation.dependencyFactories.set(
40 EntryDependency,
41 normalModuleFactory
42 );
43 }
44 );
45
46 const { entry, options, context } = this;
47 const dep = EntryPlugin.createDependency(entry, options);
48
49 compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback) => {
50 compilation.addEntry(context, dep, options, (err) => {
51 callback(err);
52 });
53 });
54 }
55
56 /**
57 * Creates a dependency.

Callers

nothing calls this directly

Calls 5

tapMethod · 0.80
createDependencyMethod · 0.80
addEntryMethod · 0.80
callbackFunction · 0.50
setMethod · 0.45

Tested by

no test coverage detected