技术博客 - welcome to my blog,AwesomeDevin's blog,trying to be a fullstack developer and sticking it !!!
npm install drop-console-webpack-plugin --save
const DropConsoleWebpackPlugin = require('drop-console-webpack-plugin')
plugins: [
new DropConsoleWebpackPlugin(),
]
if webpack version < 4 : 4.0.0>drop-console-webpack-plugin version >=3.0.0
if webpack version >= 4 : drop-console-webpack-plugin version >=4.0.0 && nodejs version > 7.6
| Name | type | default | Description |
|---|---|---|---|
| drop_log | Boolean | true | remove console.log(...) |
| drop_info | Boolean | true | remove console.info(...) |
| drop_warn | Boolean | false | remove console.warn(...) |
| drop_error | Boolean | false | remove console.error(...) |
| exclude | Array | [] | exclude chunk - you should use it to reduce building time |
| replace | Function | consoleStr=>'' | replace match string |
new DropConsoleWebpackPlugin({
drop_log : true,
drop_info : true,
drop_warn : false,
drop_error : false,
exclude : ['manifest'],
replace : ()=>'/* hello world */'
})