Registry / devops / babel-plugin-minify-dead-code-elimination-while-loop-fixed

babel-plugin-minify-dead-code-elimination-while-loop-fixed

JSON →
library0.3.1jsnpmunverified

A forked and fixed version of babel-plugin-minify-dead-code-elimination from Babel minify 0.3.x. It inlines bindings, evaluates expressions, and removes unreachable code. This plugin specifically addresses a bug related to while loops (issue #11343). Current stable version: 0.3.1. No regular release cadence; maintained sporadically. Key differentiator: fixes a specific loop elimination bug not present in the original plugin.

npm install babel-plugin-minify-dead-code-elimination-while-loop-fixed
INSTALL
IMPORT
SIG · BABEL-PLUGIN-MINIF
B
babel-plugin-minify-dead-code-elimination-while-loop-fixed
devopsjavascriptv0.3.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
module.exports = require('babel-plugin-minify-dead-code-elimination-while-loop-fixed')
import plugin from 'babel-plugin-minify-dead-code-elimination-while-loop-fixed'
This package is a CommonJS plugin. Use require() for Node.js/Babel config. ESM import is not supported.
function
{ "plugins": ["minify-dead-code-elimination-while-loop-fixed"] }
{ "plugins": ["babel-plugin-minify-dead-code-elimination-while-loop-fixed"] }
In .babelrc or babel.config.js, omit the 'babel-plugin-' prefix. Use the short name.
options
{ "plugins": [["minify-dead-code-elimination-while-loop-fixed", { "keepFnName": true }]] }
{ "plugins": ["minify-dead-code-elimination-while-loop-fixed", { "keepFnName": true }] }
When passing options, the plugin must be specified as an array inside another array. Missing the inner array will cause options to be ignored.

Shows how to install and configure the plugin in .babelrc, and the effect of dead code elimination.

// Install the plugin // npm install babel-plugin-minify-dead-code-elimination-while-loop-fixed // .babelrc example { "presets": ["@babel/preset-env"], "plugins": ["minify-dead-code-elimination-while-loop-fixed"] } // Input code function foo() { var x = 1; } function bar() { var x = f(); } function baz() { var x = 1; console.log(x); function unused() { return 5; } } // After transformation (output) // function foo() {} // function bar() { f(); } // function baz() { // console.log(1); // }
Debug
Known issues
breakingPlugin uses deprecated babel-core API (babel.transform). May not work with Babel 7+.
fix
Upgrade to @babel/core and use @babel/plugin-transform-modules-commonjs or similar. Alternatively, stick with Babel 6.
affects: >=0.3.1
gotchaPlugin only works as a Babel plugin; it cannot be used standalone.
fix
Ensure Babel is installed and the plugin is declared in the Babel configuration.
affects: >=0
gotchaOptions must be nested correctly: [["minify-dead-code-elimination-while-loop-fixed", options]].
fix
Use the correct array nesting pattern shown in the documentation.
affects: >=0
deprecatedThe original babel-plugin-minify-dead-code-elimination is deprecated in favor of babel-preset-minify.
fix
Consider using babel-preset-minify for a comprehensive minification setup.
affects: >=0
Errors
Common errors & fixes
Error: Cannot find module 'babel-plugin-minify-dead-code-elimination-while-loop-fixed'
Plugin not installed or typo in module name.
fix
Run npm install babel-plugin-minify-dead-code-elimination-while-loop-fixed --save-dev
TypeError: The plugin "minify-dead-code-elimination-while-loop-fixed" didn't return a function.
Using ESM import instead of require(). The plugin exports via module.exports.
fix
Use require() in Node.js or configure Babel with the string plugin name in .babelrc.
Error: .babelrc: plugins[0] must be a string or an array of [string, options]
Options not nested correctly in an array.
fix
Use [["minify-dead-code-elimination-while-loop-fixed", { ... }]] syntax.
Upgrade
Version history
0.3.1latest on npm
Audit
Dependencies
babel-corerequiredRequired for plugin to be loaded and used in Babel transformations.
Agent activity
4 hits · last 30 days
node
4
Resources
babel-plugin-minify-dead-code-elimination-while-loop-fixed — npm install babel-plugin-minify-dead-code-elimination-while-loop-fixed · libregistry