diff --git a/declarations/WebpackOptions.d.ts b/declarations/WebpackOptions.d.ts index 26cedce42..d48417a17 100644 --- a/declarations/WebpackOptions.d.ts +++ b/declarations/WebpackOptions.d.ts @@ -387,7 +387,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/NoModeWarning.js b/lib/NoModeWarning.js index d610ff321..9f13e6159 100644 --- a/lib/NoModeWarning.js +++ b/lib/NoModeWarning.js @@ -17,7 +17,7 @@ module.exports = class NoModeWarning extends WebpackError { "The 'mode' option has not been set, webpack will fallback to 'production' for this value. " + "Set 'mode' option to 'development' or 'production' to enable defaults for each environment.\n" + "You can also set it to 'none' to disable any default behavior. " + - "Learn more: https://webpack.js.org/concepts/mode/"; + "Learn more: https://webpack.js.org/configuration/mode/"; Error.captureStackTrace(this, this.constructor); } diff --git a/lib/stats/DefaultStatsPresetPlugin.js b/lib/stats/DefaultStatsPresetPlugin.js index a69cc6716..f65319492 100644 --- a/lib/stats/DefaultStatsPresetPlugin.js +++ b/lib/stats/DefaultStatsPresetPlugin.js @@ -72,6 +72,11 @@ const NAMED_PRESETS = { errors: true, moduleTrace: true }, + "errors-warnings": { + all: false, + errors: true, + warnings: true + }, none: { all: false } diff --git a/schemas/WebpackOptions.json b/schemas/WebpackOptions.json index d384fd363..bfa283907 100644 --- a/schemas/WebpackOptions.json +++ b/schemas/WebpackOptions.json @@ -2297,7 +2297,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 a36de8fc0..dcb71c35f 100644 --- a/test/__snapshots__/StatsTestCases.test.js.snap +++ b/test/__snapshots__/StatsTestCases.test.js.snap @@ -1607,7 +1607,7 @@ Entrypoint entry = entry.js `; exports[`StatsTestCases should print correct stats for no-emit-on-errors-plugin-with-child-error 1`] = ` -"Hash: 7f9d32f2adc8ce1b4119 +"Hash: 181c7c6a6c7397755ac2 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names @@ -1618,7 +1618,7 @@ Entrypoint main = bundle.js WARNING in configuration The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment. -You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/ +You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/ Child child: Time: Xms @@ -2042,6 +2042,8 @@ Module not found: Error: Can't resolve 'does-not-exist' in 'Xdir/preset-errors-o " `; +exports[`StatsTestCases should print correct stats for preset-errors-warnings 1`] = `""`; + exports[`StatsTestCases should print correct stats for preset-minimal 1`] = `" 10 modules"`; exports[`StatsTestCases should print correct stats for preset-minimal-simple 1`] = `" 1 module"`; diff --git a/test/fixtures/b.js b/test/fixtures/b.js index b5def9576..7e6505aa8 100644 --- a/test/fixtures/b.js +++ b/test/fixtures/b.js @@ -3,4 +3,4 @@ module.exports = function b() { }; // Test CJS top-level return -return; \ No newline at end of file +return; diff --git a/test/statsCases/preset-errors-warnings/index.js b/test/statsCases/preset-errors-warnings/index.js new file mode 100644 index 000000000..e69de29bb 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 000000000..5c54a2307 --- /dev/null +++ b/test/statsCases/preset-errors-warnings/webpack.config.js @@ -0,0 +1,5 @@ +module.exports = { + mode: "production", + entry: "./index", + stats: "errors-warnings" +}; diff --git a/yarn.lock b/yarn.lock index 620495710..d8cd165d5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1722,9 +1722,9 @@ escodegen@^1.9.1: source-map "~0.6.1" eslint-config-prettier@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-4.1.0.tgz#181364895899fff9fd3605fecb5c4f20e7d5f395" - integrity sha512-zILwX9/Ocz4SV2vX7ox85AsrAgXV3f2o2gpIicdMIOra48WYqgUnWNH/cR/iHtmD2Vb3dLSC3LiEJnS05Gkw7w== + version "4.2.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-4.2.0.tgz#70b946b629cd0e3e98233fd9ecde4cb9778de96c" + integrity sha512-y0uWc/FRfrHhpPZCYflWC8aE0KRJRY04rdZVfl8cL3sEZmOYyaBdhdlQPjKZBnuRMyLVK+JUZr7HaZFClQiH4w== dependencies: get-stdin "^6.0.0" @@ -1737,9 +1737,9 @@ eslint-plugin-es@^1.3.1: regexpp "^2.0.1" eslint-plugin-jest@^22.2.2: - version "22.4.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.4.1.tgz#a5fd6f7a2a41388d16f527073b778013c5189a9c" - integrity sha512-gcLfn6P2PrFAVx3AobaOzlIEevpAEf9chTpFZz7bYfc7pz8XRv7vuKTIE4hxPKZSha6XWKKplDQ0x9Pq8xX2mg== + version "22.5.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.5.1.tgz#a31dfe9f9513c6af7c17ece4c65535a1370f060b" + integrity sha512-c3WjZR/HBoi4GedJRwo2OGHa8Pzo1EbSVwQ2HFzJ+4t2OoYM7Alx646EH/aaxZ+9eGcPiq0FT0UGkRuFFx2FHg== eslint-plugin-node@^8.0.0: version "8.0.1" @@ -2243,9 +2243,9 @@ glob@^5.0.15: path-is-absolute "^1.0.0" glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3: - version "7.1.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" - integrity sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ== + version "7.1.4" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" + integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -4604,14 +4604,14 @@ raw-loader@~0.5.1: integrity sha1-DD0L6u2KAclm2Xh793goElKpeao= react-dom@^16.8.0: - version "16.8.5" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.8.5.tgz#b3e37d152b49e07faaa8de41fdf562be3463335e" - integrity sha512-VIEIvZLpFafsfu4kgmftP5L8j7P1f0YThfVTrANMhZUFMDOsA6e0kfR6wxw/8xxKs4NB59TZYbxNdPCDW34x4w== + version "16.8.6" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.8.6.tgz#71d6303f631e8b0097f56165ef608f051ff6e10f" + integrity sha512-1nL7PIq9LTL3fthPqwkvr2zY7phIPjYrT0jp4HjyEQrEROnw4dG41VVwi/wfoCneoleqrNX7iAD+pXebJZwrwA== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1" prop-types "^15.6.2" - scheduler "^0.13.5" + scheduler "^0.13.6" react-is@^16.8.1: version "16.8.3" @@ -4905,7 +4905,7 @@ sax@^1.2.4: resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== -scheduler@^0.13.5, scheduler@^0.13.6: +scheduler@^0.13.6: version "0.13.6" resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.13.6.tgz#466a4ec332467b31a91b9bf74e5347072e4cd889" integrity sha512-IWnObHt413ucAYKsD9J1QShUKkbKLQQHdxRyw73sw4FN26iWr3DY/H34xGPe4nmL1DwXyWmSWmMrA9TfQbE/XQ== @@ -5000,9 +5000,9 @@ signal-exit@^3.0.0, signal-exit@^3.0.2: integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= simple-git@^1.65.0, simple-git@^1.85.0: - version "1.110.0" - resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-1.110.0.tgz#54eb179089d055a7783d32399246cebc9d9933e9" - integrity sha512-UYY0rQkknk0P5eb+KW+03F4TevZ9ou0H+LoGaj7iiVgpnZH4wdj/HTViy/1tNNkmIPcmtxuBqXWiYt2YwlRKOQ== + version "1.113.0" + resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-1.113.0.tgz#668989728a1e9cf4ec6c72b69ea2eecc93489bea" + integrity sha512-i9WVsrK2u0G/cASI9nh7voxOk9mhanWY9eGtWBDSYql6m49Yk5/Fan6uZsDr/xmzv8n+eQ8ahKCoEr8cvU3h+g== dependencies: debug "^4.0.1"