{"id":20815,"library":"webpack-remove-debug","title":"webpack-remove-debug","description":"A Webpack loader that removes all calls to the `debug` library and its associated require statements from your production code. v0.1.0, last release in 2021, no active maintenance. It specifically targets `debug(…)` function calls and `require('debug')` patterns, with no configuration parameters. Similar to strip-loader but limited to debug and only works for CommonJS require, not ES module imports. No updates or security patches since release.","status":"abandoned","version":"0.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/johngodley/webpack-remove-debug","tags":["javascript","webpack","debug","strip","remove"],"install":[{"cmd":"npm install webpack-remove-debug","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-remove-debug","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-remove-debug","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This is not a JavaScript import, but a Webpack loader rule. It only works with require-style debug imports, not ES module imports.","wrong":"import webpackRemoveDebug from 'webpack-remove-debug';","symbol":"webpack-remove-debug (loader)","correct":"module.exports = { module: { rules: [{ test: /\\.js$/, loader: 'webpack-remove-debug' }] } };"},{"note":"The loader only strips CommonJS require patterns for debug. ES import syntax is not recognized and will not be removed.","wrong":"import debug from 'debug';","symbol":"debug","correct":"const debug = require('debug')('myapp');"},{"note":"Only simple function call syntax with parentheses is removed. Optional chaining or template literals may not be stripped.","wrong":"debug?.('message');","symbol":"debug()","correct":"debug('some message', data);"}],"quickstart":{"code":"// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.js$/,\n        loader: 'webpack-remove-debug'\n      }\n    ]\n  }\n};\n\n// In your source code (will be stripped):\nconst debug = require('debug')('myapp');\ndebug('This will be removed in production');\n\n// In your source code (will NOT be stripped):\nimport debug from 'debug';\ndebug('This will remain, not removed');","lang":"javascript","description":"Shows Webpack configuration and the difference between require and import: only require-style debug usage is stripped."},"warnings":[{"fix":"Use `const debug = require('debug')('...')` instead of import, or use an alternative loader that supports ES modules.","message":"Does not strip ES module imports (`import debug from 'debug'`). Only CommonJS `require` is supported.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Ensure debug calls are in the form `debug('message', ...);` for removal.","message":"Only removes simple `debug(...)` calls. Complex expressions like `debug && debug('msg')` or chained calls are not stripped.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use a more thorough stripping tool like strip-loader or babel-plugin-transform-remove-console for production.","message":"If you have other code using debug variable (e.g., pass it around), the loader may break scope inadvertently.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'2021':29 'activ':31 'associ':18 'call':11,38 'code':24 'commonj':60 'configur':45 'debug':4,14,36,41,55,75 'es':63 'function':37 'import':65 'javascript':73 'last':26 'librari':15 'limit':53 'loader':7,51 'mainten':32 'modul':64 'paramet':46 'patch':70 'pattern':42 'product':23 'releas':27,72 'remov':3,9,77 'requir':19,40,61 'secur':69 'similar':47 'sinc':71 'specif':34 'statement':20 'strip':50,76 'strip-load':49 'target':35 'updat':67 'v0.1.0':25 'webpack':2,6,74 'webpack-remove-debug':1 'work':58","created_at":"2026-04-25T11:25:07.198489+00:00","updated_at":"2026-04-25T11:25:07.198489+00:00","problems":[{"fix":"Run `npm install --save-dev webpack-remove-debug`.","cause":"Loader not installed or missing from node_modules.","error":"Error: Module not found: Error: Can't resolve 'webpack-remove-debug'"},{"fix":"Ensure the rule is added before other loaders (e.g., babel-loader). Example: `{ test: /\\.js$/, use: [{ loader: 'webpack-remove-debug' }, { loader: 'babel-loader' }] }`","cause":"Webpack expects a loader rule, but the loader might be misconfigured or order is wrong.","error":"Module parse failed: Unexpected token (1:0) You may need an appropriate loader to handle this file type."},{"fix":"Change `import debug from 'debug'` to `const debug = require('debug')('...')`. Or omit loader and handle differently.","cause":"The require statement was stripped but debug calls remain (maybe due to import syntax).","error":"debug is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/johngodley/webpack-remove-debug","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/webpack-remove-debug","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}