Skip to content

Commit

Permalink
Merge pull request #8919 from vincentrodriguez/errors-and-warnings-on…
Browse files Browse the repository at this point in the history
…ly-preset

Preset option for errors & warnings only
  • Loading branch information
sokra committed May 9, 2019
2 parents fed4c3d + 111e864 commit b17543e
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 2 deletions.
9 changes: 8 additions & 1 deletion declarations/WebpackOptions.d.ts
Expand Up @@ -369,7 +369,14 @@ export interface WebpackOptions {
stats?:
| StatsOptions
| boolean
| ("none" | "errors-only" | "minimal" | "normal" | "detailed" | "verbose");
| (
| "none"
| "errors-only"
| "minimal"
| "normal"
| "detailed"
| "verbose"
| "errors-warnings");
/**
* Environment to build for
*/
Expand Down
6 changes: 6 additions & 0 deletions lib/Stats.js
Expand Up @@ -1408,6 +1408,12 @@ class Stats {
errors: true,
moduleTrace: true
};
case "errors-warnings":
return {
all: false,
errors: true,
warnings: true
};
default:
return {};
}
Expand Down
3 changes: 2 additions & 1 deletion schemas/WebpackOptions.json
Expand Up @@ -2110,7 +2110,8 @@
"minimal",
"normal",
"detailed",
"verbose"
"verbose",
"errors-warnings"
]
}
]
Expand Down
2 changes: 2 additions & 0 deletions test/__snapshots__/StatsTestCases.test.js.snap
Expand Up @@ -1915,6 +1915,8 @@ Module not found: Error: Can't resolve 'does-not-exist' in 'Xdir/preset-errors-o
@ ./index.js 1:0-25"
`;

exports[`StatsTestCases should print correct stats for preset-errors-warnings 1`] = `""`;

exports[`StatsTestCases should print correct stats for preset-minimal 1`] = `" 6 modules"`;

exports[`StatsTestCases should print correct stats for preset-minimal-simple 1`] = `" 1 module"`;
Expand Down
Empty file.
5 changes: 5 additions & 0 deletions test/statsCases/preset-errors-warnings/webpack.config.js
@@ -0,0 +1,5 @@
module.exports = {
mode: "production",
entry: "./index",
stats: "errors-warnings"
};

0 comments on commit b17543e

Please sign in to comment.