1 | /*
|
2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
3 | Author Tobias Koppers @sokra
|
4 | */
|
5 |
|
6 | ;
|
7 |
|
8 | /** @typedef {import("./Compiler")} Compiler */
|
9 |
|
10 | class NoEmitOnErrorsPlugin {
|
11 | /**
|
12 | * Apply the plugin
|
13 | * @param {Compiler} compiler the compiler instance
|
14 | * @returns {void}
|
15 | */
|
16 | apply(compiler) {
|
17 | compiler.hooks.shouldEmit.tap("NoEmitOnErrorsPlugin", compilation => {
|
18 | if (compilation.getStats().hasErrors()) return false;
|
19 | });
|
20 | compiler.hooks.compilation.tap("NoEmitOnErrorsPlugin", compilation => {
|
21 | compilation.hooks.shouldRecord.tap("NoEmitOnErrorsPlugin", () => {
|
22 | if (compilation.getStats().hasErrors()) return false;
|
23 | });
|
24 | });
|
25 | }
|
26 | }
|
27 |
|
28 | module.exports = NoEmitOnErrorsPlugin;
|