This plugin allows Babel to transform boolean literals into !0 for true and !1 for false
GitHub · npm · Edit this page
In
true;
false;
Out
!0;
!1;
npm install babel-plugin-transform-minify-booleans
.babelrc
(Recommended).babelrc
{
"plugins": ["transform-minify-booleans"]
}
babel --plugins transform-minify-booleans script.js
require("babel-core").transform("code", {
plugins: ["transform-minify-booleans"]
});