/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/statsCases/warnings-count/webpack.config.js
37 строк
880 B
Alexander Akait
refactor: reduce EXPECTED_ANY in stats hook and printer types (#21198)
16 июн 2026, 22:20
Не верифицирован
16 июн 2026, 22:20
b15a94c
Код
Авторство
О чём код?
"use strict"; const webpack = require("../../../"); const PLUGIN_NAME = "AddWarningsPlugin"; // Emits warnings without an `ignoreWarnings`/`warningsFilter`, so `warningsCount` // is computed from the raw warnings; details are hidden to assert the count alone. /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", entry: "./index.js", stats: { all: false, warnings: false, warningsCount: true }, plugins: [ { /** * @param {import("../../../").Compiler} compiler the compiler * @returns {void} */ apply(compiler) { compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.afterSeal.tap(PLUGIN_NAME, () => { for (let i = 0; i < 3; i++) { compilation.warnings.push( new webpack.WebpackError(`Warning ${i}`) ); } }); }); } } ] };