babel-plugin-ts-enum-iife
babel-plugin-ts-enum-iife
npm i babel-plugin-ts-enum-iife
babel-plugin-ts-enum-iife

babel-plugin-ts-enum-iife

🔨 Collection of front-end engineering tools

by planjs

0.8.1 (see all)License:MITTypeScript:Not Found
npm i babel-plugin-ts-enum-iife
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;
}();

Downloads/wk

15

GitHub Stars

20

LAST COMMIT

9mos ago

MAINTAINERS

1

CONTRIBUTORS

0

OPEN ISSUES

0

OPEN PRs

1
VersionTagPublished
0.8.1
latest
5mos ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate