0.1.0 • Published 9 years ago

webpack-strip v0.1.0

Weekly downloads
484
License
-
Repository
github
Last release
9 years ago

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 () {
    // The following two lines of code will be stripped with our webpack loader
    debug('makeFoo called');
    debug('makeFoo args', arguments);
    // This code would remain
    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') }
        ]
    }
};