-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.js
More file actions
26 lines (23 loc) · 802 Bytes
/
plugin.js
File metadata and controls
26 lines (23 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { TAG } from './index';
import { bgRed } from 'chalk';
function BadCssPlugin() {}
BadCssPlugin.prototype.apply = function(complier) {
complier.plugin('done', function(stats){
const warnings = stats.compilation.warnings;
const restWarnings = [];
const badCssLoaderWarnings = [];
warnings.map((warning) => {
const { warning: _warning = {} } = warning;
if ((_warning.tag && _warning.tag.indexOf(TAG) > -1) || warning.message.indexOf(TAG) > -1) {
badCssLoaderWarnings.push(warning);
} else {
restWarnings.push(warning);
}
});
stats.compilation.warnings = restWarnings;
badCssLoaderWarnings.map((error) => {
setTimeout(() => {console.log(bgRed('Warning', error.message))}, 0);
});
});
}
export default BadCssPlugin;