Package Exports
- babel-plugin-minify-simplify
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (babel-plugin-minify-simplify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
babel-plugin-minify-simplify
Simplifies code for minification by reducing statements into expressions and making expressions uniform where possible.
Example
Reduce statement into expression
In
function foo() {
if (x) a();
}
function foo2() {
if (x) a();
else b();
}Out
function foo() {
x && a();
}
function foo2() {
x ? a() : b();
}Make expression as uniform as possible for better compressibility
In
undefined
foo['bar']
Number(foo)Out
void 0
foo.bar
+fooInstallation
npm install babel-plugin-minify-simplify --save-devUsage
Via .babelrc (Recommended)
.babelrc
{
"plugins": ["minify-simplify"]
}Via CLI
babel --plugins minify-simplify script.jsVia Node API
require("@babel/core").transform("code", {
plugins: ["minify-simplify"]
});