1.0.3 • Published 5 years ago

@bigmogician/webpack-warning-plugin v1.0.3

Weekly downloads
29
License
MIT
Repository
github
Last release
5 years ago

webpack-warning-plugin

a filter of webpack output warnings.

environment

  • webpack@^4.4.0
  • typescript@^3.4.5

install

#use yarn
yarn add @bigmogician/webpack-warning-plugin -D
#use npm
npm install @bigmogician/webpack-warning-plugin --save-dev

usage

default example

webpack.config.js

const { WarningPlugin } = require("@bigmogician/webpack-warning-plugin");

module.exports = {
  plugins: [
    new WarningPlugin();
  ]
};

use match expression to filter warnings

  • default: []

webpack.config.js

const { WarningPlugin } = require("@bigmogician/webpack-warning-plugin");

module.exports = {
  plugins: [
    new WarningPlugin({
      rules: {
        global: {
          match: [
            "not found",
            /^module .*/gi,
            (warning) => warning.error.message.length === 3
          ]
        }
      }
    });
  ]
};

use your custom tsconfig.json

  • default: "tsconfig.json"

webpack.config.js

const { WarningPlugin } = require("@bigmogician/webpack-warning-plugin");

module.exports = {
  plugins: [
    new WarningPlugin({
      options: {
        tsconfig: "tsconfig.custom.json"
      }
    });
  ]
};

close the ignore filter for "vue exports not found" warnings

  • default: false

webpack.config.js

const { WarningPlugin } = require("@bigmogician/webpack-warning-plugin");

module.exports = {
  plugins: [
    new WarningPlugin({
      rules: {
        vue: {
          ignoreModuleExportNotFoundForTs: true
        }
      }
    });
  ]
};