1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/open-hand-choerodon-ui

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
CleanUpStatsPlugin.js 1.1 КБ
Копировать Редактировать Исходные данные Просмотреть построчно История
HughHzWu Отправлено 6 лет назад 951db21
// We should use `stats` props of webpack. But it not work in v4.
class CleanUpStatsPlugin {
constructor(option) {
this.option = {
MiniCSSExtractPlugin: true,
tsLoader: true,
...option,
};
}
shouldPickStatChild(child) {
const { MiniCSSExtractPlugin } = this.option;
if (MiniCSSExtractPlugin && child.name.includes('mini-css-extract-plugin')) return false;
return true;
}
shouldPickWarning(message) {
const { tsLoader } = this.option;
if (tsLoader && /export .* was not found in .*/.test(message)) {
return false;
}
return true;
}
apply(compiler) {
compiler.hooks.done.tap('CleanUpStatsPlugin', stats => {
const { children, warnings } = stats.compilation;
if (Array.isArray(children)) {
stats.compilation.children = children.filter(child => this.shouldPickStatChild(child));
}
if (Array.isArray(warnings)) {
stats.compilation.warnings = warnings.filter(message => this.shouldPickWarning(message));
}
});
}
}
module.exports = CleanUpStatsPlugin;

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/open-hand-choerodon-ui.git
git@gitlife.ru:oschina-mirror/open-hand-choerodon-ui.git
oschina-mirror
open-hand-choerodon-ui
open-hand-choerodon-ui
1.4.1