DEV Community

xgqfrms
xgqfrms

Posted on

Answer: Remove console.logs with Webpack & Uglify

webpack 4.x remove console.log solutions

  1. only remove the console.log but leave other consoles (recommend ✅)

pure_funcs: ['console.log']

const UglifyJSPlugin = require('uglifyjs-webpack-plugin') // webpack.config.js module.exports = { // ... optimization: { minimizer: [ new UglifyJSPlugin({ uglifyOptions: { compress: { pure_funcs: [ 'console.log', // 'console.error', // 'console.warn', // ... ], }, //

Top comments (0)