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

Method apply

lib/PrefetchPlugin.js:37–56  ·  view source on GitHub ↗

* 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

35 * @returns {void}
36 */
37 apply(compiler) {
38 compiler.hooks.compilation.tap(
39 PLUGIN_NAME,
40 (compilation, { normalModuleFactory }) => {
41 compilation.dependencyFactories.set(
42 PrefetchDependency,
43 normalModuleFactory
44 );
45 }
46 );
47 compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback) => {
48 compilation.addModuleChain(
49 this.context || compiler.context,
50 new PrefetchDependency(this.request),
51 (err) => {
52 callback(err);
53 }
54 );
55 });
56 }
57}
58
59module.exports = PrefetchPlugin;

Callers

nothing calls this directly

Calls 4

tapMethod · 0.80
addModuleChainMethod · 0.80
callbackFunction · 0.50
setMethod · 0.45

Tested by

no test coverage detected