{"id":26644,"library":"webpack-clear-console","title":"Webpack Clear Console","description":"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.","status":"active","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/yasemincidem/webpack-clear-console","tags":["javascript","webpack","console","log","debugging","remove"],"install":[{"cmd":"npm install webpack-clear-console","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-clear-console","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-clear-console","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package exports an object with WebpackClearConsole as a property; destructuring is required.","wrong":"const WebpackClearConsole = require('webpack-clear-console');","symbol":"WebpackClearConsole","correct":"const { WebpackClearConsole } = require('webpack-clear-console');\n// or\nimport { WebpackClearConsole } from 'webpack-clear-console';"},{"note":"The package does not have a default export. Use named import.","wrong":"import WebpackClearConsole from 'webpack-clear-console';","symbol":"default import","correct":"import { WebpackClearConsole } from 'webpack-clear-console';"},{"note":"No default export exists; accessing .default results in undefined.","wrong":"const WebpackClearConsole = require('webpack-clear-console').default;","symbol":"require with wrong property","correct":"const { WebpackClearConsole } = require('webpack-clear-console');"}],"quickstart":{"code":"// webpack.config.js\nconst { WebpackClearConsole } = require('webpack-clear-console');\n\nmodule.exports = {\n  mode: 'production',\n  entry: './src/index.js',\n  output: {\n    filename: 'bundle.js',\n    path: __dirname + '/dist',\n  },\n  plugins: [\n    new WebpackClearConsole(),\n  ],\n};","lang":"javascript","description":"Basic Webpack config that removes all console statements from the output bundle using WebpackClearConsole."},"warnings":[{"fix":"Add /*NotClearConsole*/ on the same line as console.log('keep me');.","message":"The comment /*NotClearConsole*/ must be placed on the same line as or immediately after the console statement to preserve it.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure all console calls begin with console. to be removed.","message":"Only statements that start with console. are removed. Member expressions like Array.prototype.console are not affected.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade to Webpack 4 or later.","message":"Works only with Webpack 4+; plugin API may be incompatible with older Webpack versions.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"If selective removal is needed, consider using a custom loader or babel-plugin-transform-remove-console.","message":"The plugin removes all console calls regardless of severity (log, warn, error, etc.). There is no option to filter by console method.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Test with Webpack 5; if broken, use an alternative like terser-webpack-plugin drop_console.","message":"The package has not been updated since 2018; Webpack 5 compatibility is not tested.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use const { WebpackClearConsole } = require('webpack-clear-console'); then new WebpackClearConsole();","cause":"Importing the package without destructuring; using require('...') returns an object, not the constructor.","error":"TypeError: WebpackClearConsole is not a constructor"},{"fix":"Run npm install webpack-clear-console --save-dev","cause":"Package not installed or npm link issue.","error":"Module build failed: Error: Cannot find module 'webpack-clear-console'"},{"fix":"Add new WebpackClearConsole() to plugins array in webpack.config.js.","cause":"Plugin not added to plugins array or Webpack config mode not set to production.","error":"console.log statements are not removed in production build"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}