babel-plugin-ts-enum-iife
v0.11.0
Published
Transform typescript wrapper enum in IIFE
Downloads
88
Maintainers
Readme
babel-plugin-typescript-enum-iife
Transform typescript wrapper enum in IIFE, enum better tree-shaking
Usage
babel-plugin-ts-enum-iife
must be quoted first
bablerc.json
{
"plugins": [
"babel-plugin-ts-enum-iife",
"@babel/plugin-transform-typescript"
]
}
enum
enum Test {
A,
B
}
output
const Test = function () {
//__ENUM_IIFE__
let Test;
(function (Test) {
Test[Test["A"] = 0] = "A";
Test[Test["B"] = 1] = "B";
})(Test || (Test = {}));
return Test;
}();