* Applies the plugin by registering its hooks on the compiler. * @param {Compiler} compiler the compiler instance * @returns {void}
(compiler)
| 16 | * @returns {void} |
| 17 | */ |
| 18 | apply(compiler) { |
| 19 | compiler.hooks.shouldEmit.tap(PLUGIN_NAME, (compilation) => { |
| 20 | if (compilation.getStats().hasErrors()) return false; |
| 21 | }); |
| 22 | compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { |
| 23 | compilation.hooks.shouldRecord.tap(PLUGIN_NAME, () => { |
| 24 | if (compilation.getStats().hasErrors()) return false; |
| 25 | }); |
| 26 | }); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | module.exports = NoEmitOnErrorsPlugin; |