strip-console weekly downloads statistics
By i-m-anurag · npm · Webpack plugins
Strip console.* calls from JavaScript and TypeScript code
strip-console has 3 recorded weekly downloads on npm.
It ranks #2132 of 2,251 tracked npm listings by weekly downloads.
Over the past 7 days it changed by -99.6%.
PluginStats has 121 daily observations since Jun 19, 2026; the latest is from Oct 17, 2026.
About strip-console
strip-console
Strip console.* calls and debugger statements from JavaScript and TypeScript code, without breaking the code around them.
• Works as a plugin for Vite, Rollup, Rolldown, webpack, Rspack and esbuild. • Ships a CLI that rewrites a build folder in place, or audits it in CI. • Keeps arguments with side effects, keeps console.warn and console.error by default, and produces source maps.
Contents
• Install • Bundler plugin • CLI • Audit in CI • Next.js • Angular • What gets removed • Options • JavaScript API • Compared with other tools • Versioning • Development
Install
Requires Node.js 22.12 or newer.
Bundler plugin
Every entry exports one function that takes the options below.
Vite
The Vite plugin only runs during vite build, so console.log still works in the dev server.
Rollup
Rolldown
webpack
Rspack
The webpack and Rspack plugins run in every mode, so add them only to production builds as shown.
esbuild
Plugin-only options
| Option | Default | Meaning |
| include | JS, TS, JSX, TSX, .vue, .svelte, .astro | Modules to process | | exclude | node_modules | Modules to skip | | chunks | false | Also process the final output chunks (Vite, Rollup and Rolldown only) | | runtimeGuard | false | Add a runtime stub that silences the removed methods (see below) |
By default the plugin skips node_modules. Set chunks: true to also clean the bundled output, which catches console calls in dependencies and in compiled framework files. Files that fail to parse are skipped with a warning instead of failing the build.
Runtime guard
Static removal cannot see calls whose method name is only known at runtime, such as consolelevel. With runtimeGuard: true, the plugin adds a small script to the top of each entry chunk that replaces the listed methods with empty functions:
The guard silences every call to those methods, including ones kept with a /* keep */ comment, and leaves console.warn and console.error alone unless you list them. It works with every bundler above. For other setups, createRuntimeGuard(methods) from strip-console returns the script as a string, ready to inline at the top of your entry file.
CLI
The CLI works on files that are already built, so it fits any toolchain, including ones without a plugin hook.
With no folder given, both commands use dist. When a file has a .map next to it, the rewrite updates the map so it still points at your original sources.
| Flag | Meaning |
| --methods | Console methods to remove, such as log,debug | | --loggers | Extra callees to remove, such as logger.debug | | --keep-comment | Comment text that keeps the next call | | --no-debugger | Keep debugger statements | | --include | Files to process (default **/*.{js,mjs,cjs}) | | --exclude | Files to skip (default /node_modules/) | | --config | Read settings from this file | | --json | Print a machine-readable report | | --dry-run | Rewrite command only: report without writing |
Config file
Settings can live in strip-console.config.json, strip-console.config.mjs, strip-console.config.js, or a "stripConsole" key in package.json. Flags override the file.
Audit in CI
strip-console audit exits with code 1 when any console call is left, so it can guard a build even if you never rewrite files.
A failing run prints one line per call, so the log shows exactly where to look:
The same check works as a script in package.json:
Use --json to feed the report into another tool. It contains scanned, calls, a files list with each call's method, line and column, and an errors list for files that could not be parsed.
Next.js
Next.js 16 builds with Turbopack, which does not run bundler plugins, so run the CLI on the browser output after next build:
.next/static holds only the code sent to the browser, so server-side logs stay. Add strip-console audit .next/static to CI to check the result.
If you build with webpack (next build --webpack), you can use the plugin instead. Add it to client production builds only:
Angular
The Angular CLI's esbuild builder does not take extra plugins, so run the CLI on the browser output after ng build. Replace my-app with the project name from angular.json:
This also removes console.log calls inside Angular's own production code. Add strip-console audit dist/my-app/browser to CI to check the result.
What gets removed
With the default options:
| Input | Output |
| console.log('ready'); | *(line removed)* | | console.log(i++); | i++; | | console.log(await load()); | await load(); | | if (debug) console.log(state); | if (debug) ; | | const done = () => console.log('done'); | const done = () => void 0; | | console?.log?.(x); | *(line removed)* | | window.console.info('hi'); | *(line removed)* | | const { log } = console; log('x'); | *(both removed)* | | debugger; | *(line removed)* | | console.warn('slow'); | unchanged | | /* keep */ console.log('build id', id); | unchanged |
Calls through globalThis, self and global are matched too, as long as console or those names are not redeclared locally. A local variable named console is never touched.
Options
These apply to the plugin, the CLI and the JavaScript API.
| Option | Default | Meaning |
| methods | ['log', 'debug', 'info', 'trace'] | Console methods to remove | | loggers | [] | Extra callees to remove, such as 'logger.debug' | | keepComment | 'keep' | Comment text that preserves the next call | | debugger | true | Also remove debugger statements | | sourcemap | true | Return a source map (API only) | | filename | 'input.js' | Picks the parser and names the map source (API only) |
Unknown options and values of the wrong type throw a TypeError that names the option, and suggest the right name for a typo such as method. The CLI exits with code 2 and names the config file.
JavaScript API
transform throws a SyntaxError when the code does not parse. removed lists each removed call with its method, 1-based line and 0-based column.
Compared with other tools…
Description from the npm listing.
- build
- console
- console.log
- esbuild-plugin
- remove
- rollup-plugin
- strip
- unplugin
- vite-plugin
- webpack-plugin
Where strip-console sits in the listing
Each band is one page of 20. Weekly downloads on a log scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Recent observations
Full history (121)Similar npm Webpack plugins plugins
Data source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/strip-console. First seen Oct 16, 2026; last successful collection Oct 18, 2026. See the methodology.