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