mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-21 07:15:09 +00:00
708 B
708 B
babel-plugin-minify-constant-folding
Tries to evaluate expressions and inline the result. For now only deals with numbers and strings.
Example
In
"a" + "b"
2 * 3;
4 | 3;
"b" + a + "c" + "d" + g + z + "f" + "h" + "z"
Out
"ab";
6;
7;
"b" + a + "cd" + g + z + "fhz";
Installation
npm install babel-plugin-minify-constant-folding
Usage
Via .babelrc (Recommended)
.babelrc
{
"plugins": ["minify-constant-folding"]
}
Via CLI
babel --plugins minify-constant-folding script.js
Via Node API
require("babel-core").transform("code", {
plugins: ["minify-constant-folding"]
});