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

Method apply

lib/ids/NaturalChunkIdsPlugin.js:22–32  ·  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

20 * @returns {void}
21 */
22 apply(compiler) {
23 compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
24 compilation.hooks.chunkIds.tap(PLUGIN_NAME, (chunks) => {
25 const chunkGraph = compilation.chunkGraph;
26 const compareNatural = compareChunksNatural(chunkGraph);
27 /** @type {Chunk[]} */
28 const chunksInNaturalOrder = [...chunks].sort(compareNatural);
29 assignAscendingChunkIds(chunksInNaturalOrder, compilation);
30 });
31 });
32 }
33}
34
35module.exports = NaturalChunkIdsPlugin;

Callers

nothing calls this directly

Calls 4

compareChunksNaturalFunction · 0.85
assignAscendingChunkIdsFunction · 0.85
tapMethod · 0.80
sortMethod · 0.80

Tested by

no test coverage detected