1. babel-plugin-typescript-iife-enum
[![Build Status](https://img.shields.io/travis/morlay/babel-plugin-typescript-iife-enum.svg?style=flat-square)](https://travis-ci.org/morlay/babel-plugin-typescript-iife-enum) [![NPM](https://img.shields.io/npm/v/babel-plugin-typescript-iife-enum.svg?styl
babel-plugin-typescript-iife-enum
Package: babel-plugin-typescript-iife-enum
Last modified: Mon, 11 Apr 2022 16:46:09 GMT
Version: 0.2.1
License: WTFPL
Downloads: 231

Install

npm install babel-plugin-typescript-iife-enum
yarn add babel-plugin-typescript-iife-enum

babel-plugin-typescript-iife-enum

Build Status
NPM
Dependencies
License

Purpose

A TypeScript transform to wrapper enum in IIFE.

Purpose

For now TypeScript will transform enum from

 enum Test {
    Key = 1
}

to

 var Test;
(function (Test) {
    Test[Test["Key"] = 1] = "Key";
})(Test || (Test = {}));

This result is not friendly for uglyify.

So just wrapper IIFE for enum

const Test = (() => {
    enum Test {
        Key = 1
    }
  
    return Test
})

Notice

must put this plugin before @babel/plugin-transform-typescript

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin