Nuxt/packages/webpack/src/plugins/warning-ignore.ts

15 lines
382 B
TypeScript
Raw Normal View History

import { WebpackError } from 'webpack'
2020-07-02 13:02:35 +00:00
export default class WarningIgnorePlugin {
filter: (warn: WebpackError) => boolean
2020-07-02 13:02:35 +00:00
constructor (filter) {
this.filter = filter
}
apply (compiler) /* istanbul ignore next */ {
compiler.hooks.done.tap('warnfix-plugin', (stats) => {
stats.compilation.warnings = stats.compilation.warnings.filter(this.filter)
})
}
}