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

Method apply

lib/ids/NaturalModuleIdsPlugin.js:26–37  ·  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

24 * @returns {void}
25 */
26 apply(compiler) {
27 compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
28 compilation.hooks.moduleIds.tap(PLUGIN_NAME, () => {
29 const [usedIds, modulesInNaturalOrder] =
30 getUsedModuleIdsAndModules(compilation);
31 modulesInNaturalOrder.sort(
32 compareModulesByPreOrderIndexOrIdentifier(compilation.moduleGraph)
33 );
34 assignAscendingModuleIds(usedIds, modulesInNaturalOrder, compilation);
35 });
36 });
37 }
38}
39
40module.exports = NaturalModuleIdsPlugin;

Callers

nothing calls this directly

Calls 5

assignAscendingModuleIdsFunction · 0.85
tapMethod · 0.80
sortMethod · 0.80

Tested by

no test coverage detected