Webpack Strip
Simple Webpack loader to strip custom functions from your code. This can be useful if you want to use debug statements while developing your app but don't want this info exposed in your production code.
##Usage:
In your client js source files:
var debug = require('debug')('MyFile');
var makeFoo = function () {
debug('makeFoo called');
debug('makeFoo args', arguments);
return 'Foo';
};
Single function
In your webpack config:
{
module: {
loaders: [
{ test: /\.js$/, loader: "webpack-strip?strip[]=debug" }
]
}
};
Multiple functions
In your webpack config:
{
module: {
loaders: [
{ test: /\.js$/, loader: "webpack-strip?strip[]=debug,strip[]=console.log" }
]
}
};
Use as library
In your webpack config:
var WebpackStrip = require('webpack-strip')
{
module: {
loaders: [
{ test: /\.js$/, loader: WebpackStrip.loader('debug', 'console.log') }
]
}
};