diff --git a/declarations/WebpackOptions.d.ts b/declarations/WebpackOptions.d.ts index 6be525d1f5b..df597c56e68 100644 --- a/declarations/WebpackOptions.d.ts +++ b/declarations/WebpackOptions.d.ts @@ -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 */ diff --git a/lib/Stats.js b/lib/Stats.js index 039ed5169b5..28dd0fba457 100644 --- a/lib/Stats.js +++ b/lib/Stats.js @@ -1408,6 +1408,12 @@ class Stats { errors: true, moduleTrace: true }; + case "errors-warnings": + return { + all: false, + errors: true, + warnings: true + }; default: return {}; } diff --git a/schemas/WebpackOptions.json b/schemas/WebpackOptions.json index 85dcce9b4ef..5e1dc062937 100644 --- a/schemas/WebpackOptions.json +++ b/schemas/WebpackOptions.json @@ -2110,7 +2110,8 @@ "minimal", "normal", "detailed", - "verbose" + "verbose", + "errors-warnings" ] } ] diff --git a/test/__snapshots__/StatsTestCases.test.js.snap b/test/__snapshots__/StatsTestCases.test.js.snap index 3b0138b5de2..08650dcbd88 100644 --- a/test/__snapshots__/StatsTestCases.test.js.snap +++ b/test/__snapshots__/StatsTestCases.test.js.snap @@ -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"`; diff --git a/test/statsCases/preset-errors-warnings/index.js b/test/statsCases/preset-errors-warnings/index.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/statsCases/preset-errors-warnings/webpack.config.js b/test/statsCases/preset-errors-warnings/webpack.config.js new file mode 100644 index 00000000000..5c54a2307dc --- /dev/null +++ b/test/statsCases/preset-errors-warnings/webpack.config.js @@ -0,0 +1,5 @@ +module.exports = { + mode: "production", + entry: "./index", + stats: "errors-warnings" +};