2022-02-14 16:36:32 +08:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const PERSISTENCE_CACHE_INVALIDATE_ERROR = (log, config) => {
|
|
|
|
if (config.run < 2) return;
|
|
|
|
const match =
|
|
|
|
/^\[webpack\.cache\.PackFileCacheStrategy\] Pack got invalid because of write to:(.+)$/.exec(
|
|
|
|
log
|
|
|
|
);
|
|
|
|
if (match) {
|
|
|
|
return `Pack got invalid because of write to: ${match[1].trim()}`;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
const errorsFilter = [PERSISTENCE_CACHE_INVALIDATE_ERROR];
|
|
|
|
|
2022-02-15 02:31:59 +08:00
|
|
|
/**
|
|
|
|
* @param {string[]} logs logs
|
2025-04-03 00:02:22 +08:00
|
|
|
* @param {TODO} config config
|
2022-02-15 02:31:59 +08:00
|
|
|
* @returns {string[]} errors
|
|
|
|
*/
|
|
|
|
module.exports = function filterInfraStructureErrors(logs, config) {
|
2022-02-14 16:36:32 +08:00
|
|
|
const results = [];
|
|
|
|
for (const log of logs) {
|
|
|
|
for (const filter of errorsFilter) {
|
|
|
|
const result = filter(log, config);
|
2022-02-15 02:31:59 +08:00
|
|
|
if (result) results.push({ message: result });
|
2022-02-14 16:36:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return results;
|
|
|
|
};
|