* @param {Compiler} compiler the compiler instance * @returns {void}
(compiler)
| 172 | * @returns {void} |
| 173 | */ |
| 174 | apply(compiler) { |
| 175 | compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { |
| 176 | compilation.hooks.optimizeModules.tap(PLUGIN_NAME, (modules) => { |
| 177 | const { circularModules } = CycleGraph.build( |
| 178 | modules, |
| 179 | compilation.moduleGraph |
| 180 | ); |
| 181 | for (const m of modules) { |
| 182 | /** @type {BuildInfo} */ |
| 183 | (m.buildInfo).isCircular = circularModules.has(m); |
| 184 | } |
| 185 | }); |
| 186 | }); |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | module.exports = CircularModulesPlugin; |