StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
2.6 KiB
99 lines
2.6 KiB
4 years ago
|
# Strip Loader
|
||
|
|
||
|
[](http://badge.fury.io/js/strip-loader)
|
||
|
[](https://travis-ci.org/yahoo/strip-loader)
|
||
|
[](https://david-dm.org/yahoo/strip-loader)
|
||
|
[](https://david-dm.org/yahoo/strip-loader#info=devDependencies)
|
||
|
[](https://coveralls.io/r/yahoo/strip-loader?branch=master)
|
||
|
|
||
|
Simple [Webpack](http://webpack.github.io/) 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.
|
||
|
|
||
|
|
||
|
## Install
|
||
|
|
||
|
`npm install --save-dev strip-loader`
|
||
|
|
||
|
## Usage
|
||
|
|
||
|
In your client js source files:
|
||
|
|
||
|
```javascript
|
||
|
|
||
|
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:
|
||
|
|
||
|
```javascript
|
||
|
{
|
||
|
module: {
|
||
|
loaders: [
|
||
|
{ test: /\.js$/, loader: "strip-loader?strip[]=debug" }
|
||
|
]
|
||
|
}
|
||
|
};
|
||
|
```
|
||
|
|
||
|
### Multiple functions
|
||
|
In your webpack config:
|
||
|
|
||
|
```javascript
|
||
|
{
|
||
|
module: {
|
||
|
loaders: [
|
||
|
{ test: /\.js$/, loader: "strip-loader?strip[]=debug,strip[]=console.log" }
|
||
|
]
|
||
|
}
|
||
|
};
|
||
|
```
|
||
|
|
||
|
### Use as library
|
||
|
In your webpack config:
|
||
|
|
||
|
```javascript
|
||
|
var WebpackStrip = require('strip-loader');
|
||
|
|
||
|
var webpackConfig = {
|
||
|
module: {
|
||
|
loaders: [
|
||
|
{ test: /\.js$/, loader: WebpackStrip.loader('debug', 'console.log') }
|
||
|
]
|
||
|
}
|
||
|
};
|
||
|
```
|
||
|
|
||
|
### Replace unused module
|
||
|
|
||
|
So far we've removed the calls to the debug function, but your app still requires the `debug` module in the final bundle. Use the [`NormalModuleReplacementPlugin`](http://webpack.github.io/docs/list-of-plugins.html#normalmodulereplacementplugin) to replace it with an empty function:
|
||
|
|
||
|
```javascript
|
||
|
// webpack config
|
||
|
{
|
||
|
plugins: [
|
||
|
new webpack.NormalModuleReplacementPlugin(/debug/, process.cwd() + '/emptyDebug.js'),
|
||
|
]
|
||
|
}
|
||
|
|
||
|
// emptyDebug.js
|
||
|
module.exports = function() { return new Function(); };
|
||
|
```
|
||
|
|
||
|
|
||
|
|
||
|
## License
|
||
|
|
||
|
This software is free to use under the Yahoo! Inc. BSD license.
|
||
|
See the [LICENSE file][] for license text and copyright information.
|
||
|
|
||
|
[LICENSE file]: https://github.com/yahoo/strip-loader/blob/master/LICENSE.md
|