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

Method apply

lib/dll/DllEntryPlugin.js:41–77  ·  lib/dll/DllEntryPlugin.js::DllEntryPlugin.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

39 * @returns {void}
40 */
41 apply(compiler) {
42 compiler.hooks.compilation.tap(
43 PLUGIN_NAME,
44 (compilation, { normalModuleFactory }) => {
45 const dllModuleFactory = new DllModuleFactory();
46 compilation.dependencyFactories.set(
47 DllEntryDependency,
48 dllModuleFactory
49 );
50 compilation.dependencyFactories.set(
51 EntryDependency,
52 normalModuleFactory
53 );
54 }
55 );
56 compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback) => {
57 compilation.addEntry(
58 this.context,
59 new DllEntryDependency(
60 this.entries.map((e, idx) => {
61 const dep = new EntryDependency(e);
62 dep.loc = {
63 name: this.options.name,
64 index: idx
65 };
66 return dep;
67 }),
68 this.options.name
69 ),
70 this.options,
71 (error) => {
72 if (error) return callback(error);
73 callback();
74 }
75 );
76 });
77 }
78}
79
80module.exports = DllEntryPlugin;

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected