remove-debug-loader
remove debug from your code, by
- remove
require
andimport
debug - remove method name -
debug
's definition and invocation (namedebug
is default and can be config in loader options) - remove custom modules(when you patched debug library)
Installation
$ yarn add remove-debug-loader --dev
or
$ npm i --save-dev remove-debug-loader
How to use
config webpack.config.js
with:
...module: rules: test: /\.js$/ use: loader: 'remove-debug-loader' ...
this would remove these patterns
requiring debug:
const debug =
also support import
syntax:
and debug methods
since debug is log to stderr by default on server side (see here), we usually patch debug to another individual module
so you can add extra config to webpack if defining custom log method name and importing patched log library
e.g
const myLog =
in this case, we need to remove importing patchedToStdout also myLog
's definition and invocation, so set loader's options methodName
and moduleName
:
use: loader: 'remove-debug-loader' options: moduleName: 'patchedToStdout' methodName: 'myLog'
those 2 options are array, so it supports as much as keyword you want to remove
Known Issue
removing multi line debug invocation isn't support yet, i.e
License
see LICENSE