* Applies the plugin by registering its hooks on the compiler. * @param {Compiler} compiler the compiler instance * @returns {void}
(compiler)
| 28 | * @returns {void} |
| 29 | */ |
| 30 | apply(compiler) { |
| 31 | compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { |
| 32 | const moduleGraph = compilation.moduleGraph; |
| 33 | compilation.hooks.optimizeDependencies.tap(PLUGIN_NAME, (modules) => { |
| 34 | /** @type {RuntimeSpec} */ |
| 35 | let runtime; |
| 36 | for (const [name, { options }] of compilation.entries) { |
| 37 | runtime = mergeRuntimeOwned( |
| 38 | runtime, |
| 39 | getEntryRuntime(compilation, name, options) |
| 40 | ); |
| 41 | } |
| 42 | for (const module of modules) { |
| 43 | const exportsInfo = moduleGraph.getExportsInfo(module); |
| 44 | exportsInfo.setUsedInUnknownWay(runtime); |
| 45 | moduleGraph.addExtraReason(module, this.explanation); |
| 46 | } |
| 47 | }); |
| 48 | }); |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | module.exports = FlagAllModulesAsUsedPlugin; |
nothing calls this directly
no test coverage detected