webpack-clear-console is a Webpack plugin that removes console statements from the bundle during compilation. Version 1.0.3 (latest) is stable with no recent updates. It provides a comment-based exclusion mechanism (/*NotClearConsole*/) to preserve specific console calls. Compared to similar plugins like babel-plugin-transform-remove-console or terser-webpack-plugin drop_console option, this plugin offers finer control per statement, though it only supports Webpack 4+ and requires manual comment annotations. No TypeScript types are included.
npm install webpack-clear-consoleNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic Webpack config that removes all console statements from the output bundle using WebpackClearConsole.
Add /*NotClearConsole*/ on the same line as console.log('keep me');.Ensure all console calls begin with console. to be removed.
Upgrade to Webpack 4 or later.
If selective removal is needed, consider using a custom loader or babel-plugin-transform-remove-console.
Test with Webpack 5; if broken, use an alternative like terser-webpack-plugin drop_console.
Use const { WebpackClearConsole } = require('webpack-clear-console'); then new WebpackClearConsole();Run npm install webpack-clear-console --save-dev
Add new WebpackClearConsole() to plugins array in webpack.config.js.
No dependency data recorded yet.