New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

reduce-enum-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reduce-enum-webpack-plugin

将ts enum 转 js 的产物减少一半,e[e['xxx']=0]='xxx'] => e['xxx']=0,e[e.xxx=0]='xxx' => e.xxx=0

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

reduce-enum-webpack-plugin

NPM version NPM downloads

English | 中文

About

A Webpack Plugin to reduce ts enum to js artifacts

eg:

before add plugin:

enum Status {
  PAID,
  UN_PAID
}

// =>

var Status;
(function (Status) {
  Status[Status.PAID = 0] = 'PAID'
  Status[Status.UN_PAID = 1] = 'UN_PAID'
})(Status || (Status = {}))

after add plugin:

enum Status {
  PAID,
  UN_PAID
}

// =>

var Status = {
  PAID: 0,
  UN_PAID: 1
}

`ts

📦 Install

pnpm add reduce-enum-webpack-plugin -D
# or
yarn add reduce-enum-webpack-plugin -D
# or
npm i reduce-enum-webpack-plugin -D

🔨 Usage

const RuduceEnumWebpackPlugin = require('reduce-enum-webpack-plugin').default

// webpack.config.js

module.exports = {

  plugins: [
    isProduction && new RuduceEnumWebpackPlugin()
  ],
}

📄 License

reduce-enum-webpack-plugin is MIT licensed.

Keywords

webpack

FAQs

Package last updated on 05 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts