1.0.0 • Published 3 years ago

webpack-remove-console-plugin v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

webpack-remove-console-plugin

A light webpack plugin to remove console.* in your JS code without any dependencies.

Example

In

console.log('log test'); // by default
console.error('error test'); // need to configure

Out

Installation

npm install remove-console-webpack-plugin --save-dev

Usage

// webpack.config.js
const RemoveConsolePlugin = require('remove-console-webpack-plugin');

// demo1: remove console.log by default
module.exports = {
  // other code ...
  plugins: [new RemoveConsolePlugin()],
};

// demo2: remove console.log, console.warn, console.error
module.exports = {
  // other code ...
  plugins: [new RemoveConsolePlugin({ include: ['log', 'warn', 'error'] })],
};

// demo3: remove console.*
module.exports = {
  // other code ...
  plugins: [new RemoveConsolePlugin({ include: ['*'] })],
};

Options

optiondescriptiondefault
includeAn array of console methods that you want to remove.'log'