main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
919 bytes
|
Rev | Line | |
---|
[79a0317] | 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 | /**
|
---|
| 20 | * Apply the plugin
|
---|
| 21 | * @param {Compiler} compiler the compiler instance
|
---|
| 22 | * @returns {void}
|
---|
| 23 | */
|
---|
| 24 | apply(compiler) {
|
---|
| 25 | compiler.hooks.compilation.tap("IgnoreWarningsPlugin", compilation => {
|
---|
| 26 | compilation.hooks.processWarnings.tap("IgnoreWarningsPlugin", warnings =>
|
---|
| 27 | warnings.filter(
|
---|
| 28 | warning =>
|
---|
| 29 | !this._ignoreWarnings.some(ignore => ignore(warning, compilation))
|
---|
| 30 | )
|
---|
| 31 | );
|
---|
| 32 | });
|
---|
| 33 | }
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | module.exports = IgnoreWarningsPlugin;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.