webpack-filter-console-loader

1.0.0 • Public • Published

webpack-filter-console-loader

A webpack loader that filters out console.log statements. By default, it retains the logs added by the current Git user. However, you can specify other authors using the allow option.

Installation

Using npm:

npm install webpack-filter-console-loader --save-dev

Or using yarn:

yarn add webpack-filter-console-loader --dev

Usage

Directly in Webpack Configuration:

module: {
  rules: [
    {
      test: /\.js$/,
      use: 'webpack-filter-console-loader'
    }
  ]
}

Using configureWebpack in Vue CLI:

In your vue.config.js:

module.exports = {
  configureWebpack: {
    module: {
      rules: [
        {
          test: /\.js$/,
          use: 'webpack-filter-console-loader'
        }
      ]
    }
  }
}

Using chainWebpack in Vue CLI:

In your vue.config.js:

module.exports = {
  chainWebpack: config => {
    config.module
      .rule('js')
      .test(/\.js$/)
      .use('webpack-filter-console-loader')
      .loader('webpack-filter-console-loader')
      .end();
  }
}

Options

allow (Optional)

An array of git authors whose console.log statements should be retained in the code. If this option is not provided, the loader will retain only the console.log statements added by the current Git user.

Example:

{
  loader: 'webpack-filter-console-loader',
  options: {
    allow: ['Author1', 'Author2']
  }
}

License

MIT (You can add a LICENSE file to your repository and link it here.)


Readme

Keywords

Package Sidebar

Install

npm i webpack-filter-console-loader

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

3.25 kB

Total Files

3

Last publish

Collaborators

  • inconfident