webpack-filter-warnings-plugin

raw JSON →
1.2.1 verified Sat Apr 25 auth: no javascript maintenance

Webpack plugin that allows you to filter out specific warnings from webpack compilation output. Current stable version is 1.2.1, but it has not been updated since 2018 and only officially supports webpack 2, 3, and 4 (webpack 5 is not supported). This plugin is useful for suppressing unwanted warnings, but users on webpack 5 should consider alternatives like `ClientConfigPlugin` with built-in warning filtering or `webpack-fail-plugin` for different behavior. Note that it does not work with webpack 5 and may have stale peer dependencies.

error TypeError: FilterWarningsPlugin is not a constructor
cause Using ESM import syntax which returns the module object, not the constructor.
fix
Use const FilterWarningsPlugin = require('webpack-filter-warnings-plugin');
error Error: Cannot find module 'webpack-filter-warnings-plugin'
cause Package not installed or incorrect import path.
fix
Run npm install webpack-filter-warnings-plugin --save-dev
breaking Webpack 5 not supported
fix Use webpack 4 or older, or switch to a different warning filtering approach for webpack 5 (e.g., custom plugin using webpack 5's infrastructure).
deprecated Package has not been updated since 2018
fix Consider using alternatives like `webpack-fail-plugin` or built-in webpack options.
gotcha Requires CommonJS; no ESM support
fix Use require() instead of import.
npm install webpack-filter-warnings-plugin
yarn add webpack-filter-warnings-plugin
pnpm add webpack-filter-warnings-plugin

Shows how to use commonjs require to import and configure the plugin to exclude warnings matching a regex.

const FilterWarningsPlugin = require('webpack-filter-warnings-plugin');

module.exports = {
  // other webpack config...
  plugins: [
    new FilterWarningsPlugin({
      exclude: /critical dependency/i
    })
  ]
};