[Gradle, JS] Changed API for warnings filter in Webpack 5

^KT-45621 fixed
This commit is contained in:
Ilya Goncharov
2021-03-23 13:23:41 +03:00
committed by TeamCityServer
parent a113df8c43
commit fef1892219
@@ -33,24 +33,22 @@ class TeamCityErrorPlugin {
apply(compiler) { apply(compiler) {
compiler.hooks.done.tap('TeamCityErrorPlugin', (stats) => { compiler.hooks.done.tap('TeamCityErrorPlugin', (stats) => {
const warningsFilters = this.warningsFilter(stats.compilation.options.ignoreWarnings); const compilation = stats.compilation;
const warningsFilters = this.warningsFilter(compilation.options.ignoreWarnings);
stats.compilation.errors.forEach(error => { compilation.errors.forEach(error => {
const type = 'error'; const type = 'error';
if (error instanceof ModuleNotFoundError) { if (error instanceof ModuleNotFoundError) {
const module = error.module; console[type](
module.dependencies.forEach(dependency => { formatMessage(TYPED_MESSAGE, error.message, type)
console[type]( );
formatMessage(TYPED_MESSAGE, `Module '${dependency.request}' not found in '${module.resource}'`, type)); } else {
}); console[type](formatMessage(TYPED_MESSAGE, error.message, type));
return
} }
console[type](formatMessage(TYPED_MESSAGE, error.message, type));
}); });
stats.compilation.warnings compilation.warnings
.filter(warning => warningsFilters.every(warningFilter => warningFilter(warning))) .filter(warning => warningsFilters.some(warningFilter => !warningFilter(warning, compilation)))
.forEach(warning => { .forEach(warning => {
const type = 'warn'; const type = 'warn';