A Babel plugin that minifies type constructors like Boolean(), Number(), String(), Array(), and Object() where possible (e.g., replacing `new Boolean(x)` with `!!x` or `new Number(x)` with `+x`). Part of the babel-minify (formerly babili) minification preset. Version 0.4.3 is the latest stable release (2018). The babel-minify project is now in maintenance mode; no new features are expected. This plugin should be used with caution in environments requiring IE8 or lower due to potential compatibility issues. It is designed to work as part of a Babel minification pipeline, complementing other minify plugins.
npm install babel-plugin-minify-type-constructorsVerified import paths — ran on the pinned version, not inferred.
Shows how to add the plugin to Babel config and the type constructor minification transform.
Use only in modern environments or apply polyfills.
Migrate to babel-preset-minify (which includes this plugin) or other minifiers.
Use version 0.4.3 or upgrade to a later patch if available.
npm install babel-plugin-minify-type-constructors --save-dev
Review transformed code and possibly disable plugin for sensitive cases.