Last change
on this file since 8d391a1 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
964 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | /*
|
---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
---|
| 3 | Author Tobias Koppers @sokra
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | "use strict";
|
---|
| 7 |
|
---|
| 8 | /** @typedef {import("../declarations/WebpackOptions").IgnoreWarningsNormalized} IgnoreWarningsNormalized */
|
---|
| 9 | /** @typedef {import("./Compiler")} Compiler */
|
---|
| 10 |
|
---|
| 11 | class IgnoreWarningsPlugin {
|
---|
| 12 | /**
|
---|
| 13 | * @param {IgnoreWarningsNormalized} ignoreWarnings conditions to ignore warnings
|
---|
| 14 | */
|
---|
| 15 | constructor(ignoreWarnings) {
|
---|
| 16 | this._ignoreWarnings = ignoreWarnings;
|
---|
| 17 | }
|
---|
| 18 | /**
|
---|
| 19 | * Apply the plugin
|
---|
| 20 | * @param {Compiler} compiler the compiler instance
|
---|
| 21 | * @returns {void}
|
---|
| 22 | */
|
---|
| 23 | apply(compiler) {
|
---|
| 24 | compiler.hooks.compilation.tap("IgnoreWarningsPlugin", compilation => {
|
---|
| 25 | compilation.hooks.processWarnings.tap(
|
---|
| 26 | "IgnoreWarningsPlugin",
|
---|
| 27 | warnings => {
|
---|
| 28 | return warnings.filter(warning => {
|
---|
| 29 | return !this._ignoreWarnings.some(ignore =>
|
---|
| 30 | ignore(warning, compilation)
|
---|
| 31 | );
|
---|
| 32 | });
|
---|
| 33 | }
|
---|
| 34 | );
|
---|
| 35 | });
|
---|
| 36 | }
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | module.exports = IgnoreWarningsPlugin;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.