webpack-strip-assert
v0.0.1
Published
Webpack plugin to strip 'assert' statements that are only intended for development purposes
Downloads
3
Maintainers
Readme
Webpack Strip Assert
Simple Webpack loader to strip assert statements from your code. This can be useful if you want to use assert statements to provide warnings to developers before they cause bugs later in their code while allowing the code to continue executing in production without throwing errors.
###Example:
In your client js source files:
var assert = require('assert').ok
var Bar = require('Bar');
var makeFoo = function (bar, baz) {
// The following two lines of code will be stripped with our webpack loader
assert(bar instanceof Bar, 'bar param must be instance of Bar');
assert(baz.isOK(), 'baz is not ok!');
// This code would remain
return new Foo(bar, baz);
};
In your webpack config:
{
module: {
loaders: [
{ test: /\.js$/, loader: "webpack-strip-assert" }
]
}
};