{"id":20133,"library":"infinite-loop-loader","title":"infinite-loop-loader","description":"A webpack loader that transforms infinite loops (e.g., `while(true)`) by injecting an iteration counter and a throw statement when the limit is exceeded. Version 1.0.9 is the latest stable release. It is part of the OpenComponents ecosystem but can be used standalone. The loader uses falafel/acorn to parse and transform JavaScript. Unlike manual linting or AST-based approaches, this provides a runtime safeguard for accidental infinite loops in webpack-bundled code. It supports configuration of the iteration limit and Acorn parser options. The package ships TypeScript definitions.","status":"active","version":"1.0.9","language":"javascript","source_language":"en","source_url":"https://github.com/opencomponents/base-templates","tags":["javascript","oc","opencomponents","webpack","loader","inifinite-loop","webpackloader","transform","typescript"],"install":[{"cmd":"npm install infinite-loop-loader","lang":"bash","label":"npm"},{"cmd":"yarn add infinite-loop-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add infinite-loop-loader","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"AST traversal and transformation of JavaScript code","package":"falafel","optional":false},{"reason":"JavaScript parser used by falafel","package":"acorn","optional":false},{"reason":"Webpack loader utility to parse options","package":"loader-utils","optional":false}],"imports":[],"quickstart":{"code":"// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.js$/,\n        use: {\n          loader: 'infinite-loop-loader',\n          options: {\n            limit: 100000,\n            opts: {\n              allowImportExportEverywhere: true,\n            },\n          },\n        },\n      },\n    ],\n  },\n};","lang":"javascript","description":"Webpack configuration to transform infinite loops in all JS files with a limit of 100000 iterations."},"warnings":[{"fix":"Manually refactor other loop styles to while(true) if you need them to be guarded.","message":"The loader only transforms while(true) and while(1) patterns. Other infinite loop constructs (e.g., for(;;) or do{}while(true)) are not transformed.","severity":"gotcha","affected_versions":"*"},{"fix":"Avoid using the identifier __ITER in your source code, or rename it if possible.","message":"The injected counter variable name (__ITER) can conflict with user-declared variables. The loader does not perform scope analysis.","severity":"gotcha","affected_versions":"*"},{"fix":"Set a sensible limit via the `limit` option in the loader configuration.","message":"The default iteration limit is 1000000000, which is extremely high and may not catch unintended infinite loops in a timely manner.","severity":"gotcha","affected_versions":"*"},{"fix":"Upgrade to a maintained alternative or check compatibility with webpack 5.","message":"Minimum webpack version required is 2. May not work with webpack 5 due to changes in loader API.","severity":"breaking","affected_versions":">=5.0"},{"fix":"Consider using a more modern AST-based tool or babel plugin.","message":"The package relies on falafel, which is no longer actively maintained. Acorn options are passed through falafel, which may cause issues with newer Acorn versions.","severity":"deprecated","affected_versions":"*"}],"env_vars":null,"search_vec":"'1.0.9':30 'accident':71 'acorn':87 'approach':64 'ast':62 'ast-bas':61 'base':63 'bundl':77 'code':78 'configur':81 'counter':19 'definit':94 'e.g':12 'ecosystem':42 'exceed':28 'falafel/acorn':51 'infinit':2,10,72 'infinite-loop-load':1 'inifinit':101 'inifinite-loop':100 'inject':16 'iter':18,84 'javascript':56,95 'latest':33 'limit':26,85 'lint':59 'loader':4,7,49,99 'loop':3,11,73,102 'manual':58 'oc':96 'opencompon':41,97 'option':89 'packag':91 'pars':53 'parser':88 'part':38 'provid':66 'releas':35 'runtim':68 'safeguard':69 'ship':92 'stabl':34 'standalon':47 'statement':23 'support':80 'throw':22 'transform':9,55,104 'true':14 'typescript':93,105 'unlik':57 'use':46,50 'version':29 'webpack':6,76,98 'webpack-bundl':75 'webpackload':103","created_at":"2026-04-25T11:21:30.250337+00:00","updated_at":"2026-04-25T11:21:30.250337+00:00","problems":[{"fix":"Run `npm install --save-dev infinite-loop-loader` and check that node_modules contains the package.","cause":"The loader is not installed or webpack cannot resolve it.","error":"Module build failed: Error: 'infinite-loop-loader' is not a valid loader"},{"fix":"Update to the latest version of infinite-loop-loader and ensure the `opts` object contains valid Acorn parser options.","cause":"Falafel's iteratee function is not compatible with the version used by this loader, or the Acorn options are invalid.","error":"Error: custom iteratee is not supported"},{"fix":"Ensure the `test` regex only matches .js files and that the files contain valid JavaScript syntax.","cause":"The loader received a malformed source or an empty file. This can happen if the file is not valid JavaScript or if the test pattern matches non-JS files.","error":"TypeError: Cannot read properties of undefined (reading 'start')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/opencomponents/base-templates","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/infinite-loop-loader","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","testing","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-04-25","next_check":"2026-07-24","install_tag":null}}