infinite-loop-loader
v1.0.9
Published
A webpack loader to transform ∞ loops so that they throw
Downloads
2,074
Readme
infinite-loop-loader
A webpack 2 loader to transform ∞ loops so that they throw
Before:
while(true){
// your logic here
}
After:
var __ITER = 1000000000;
while(true) {
if (__ITER <= 0) {
throw new Error("Loop exceeded maximum allowed iterations");
}
// your logic here
__ITER--;
}
Installation
npm install --save-dev infinite-loop-loader
Usage
Webpack config example
...
module: {
rules: [
{
test: /\.js$/,
use: [
loader: 'infinite-loop-loader',
options: {
// iteration limit
limit: 10000,
// falafel -> acorn options
opts {
allowImportExportEverywhere: true
}
}
]
}
],
...
}
...