* Applies the plugin by registering its hooks on the compiler. * @param {Compiler} compiler the compiler instance * @returns {void}
(compiler)
| 30 | * @returns {void} |
| 31 | */ |
| 32 | apply(compiler) { |
| 33 | compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { |
| 34 | const moduleGraph = compilation.moduleGraph; |
| 35 | compilation.hooks.seal.tap(PLUGIN_NAME, () => { |
| 36 | for (const [ |
| 37 | entryName, |
| 38 | { dependencies: deps, options } |
| 39 | ] of compilation.entries) { |
| 40 | const runtime = getEntryRuntime(compilation, entryName, options); |
| 41 | for (const dep of deps) { |
| 42 | const module = moduleGraph.getModule(dep); |
| 43 | if (module) { |
| 44 | const exportsInfo = moduleGraph.getExportsInfo(module); |
| 45 | if (this.nsObjectUsed) { |
| 46 | exportsInfo.setUsedInUnknownWay(runtime); |
| 47 | } else { |
| 48 | exportsInfo.setAllKnownExportsUsed(runtime); |
| 49 | } |
| 50 | moduleGraph.addExtraReason(module, this.explanation); |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | }); |
| 55 | }); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | module.exports = FlagEntryExportAsUsedPlugin; |
nothing calls this directly
no test coverage detected