* Applies the plugin by registering its hooks on the compiler. * @param {Compiler} compiler the compiler instance * @returns {void}
(compiler)
| 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 | |
| 35 | module.exports = NaturalChunkIdsPlugin; |
nothing calls this directly
no test coverage detected