0.3.0 • Published 2 years ago

@drinkcode/remove-console-webpack-plugin v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

remove-console-webpack-plugin

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

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'