New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

unplugin-inline-enum

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unplugin-inline-enum

Inline enum values to optimize bundle size.

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-61.54%
Maintainers
0
Weekly downloads
 
Created
Source

unplugin-inline-enum npm jsr

Unit Test

Inline enum values to optimize bundle size.

Features

  • 🚀 Inline enum values to reduce the size of the bundle.
  • 🧹 Simplify generated enums in JavaScript.
export enum TestEnum {
  a = 1,
  b = 'foo',
}
console.log(TestEnum.a, TestEnum.b)

// before
export let TestEnum
;(function (TestEnum) {
  TestEnum[(TestEnum.a = 1)] = 'a'
  TestEnum.b = 'foo'
})(TestEnum || (TestEnum = {}))

console.log(TestEnum.a, TestEnum.b)

// after
const TestEnum = {
  a: 1,
  '1': 'a',
  b: 'foo',
}
console.log(1, 'foo')

Installation

# npm
npm i -D unplugin-inline-enum

# jsr
npx jsr add -D @unplugin/inline-enum
Vite
// vite.config.ts
import InlineEnum from 'unplugin-inline-enum/vite'

export default defineConfig({
  plugins: [InlineEnum()],
})


Rollup
// rollup.config.js
import InlineEnum from 'unplugin-inline-enum/rollup'

export default {
  plugins: [InlineEnum()],
}


esbuild
// esbuild.config.js
import { build } from 'esbuild'

build({
  plugins: [require('unplugin-inline-enum/esbuild')()],
})


Webpack
// webpack.config.js
module.exports = {
  /* ... */
  plugins: [require('unplugin-inline-enum/webpack')()],
}


Options

Refer to docs.

Credits

Thanks to @xiaoxiangmoe and @yangmingshan for their contributions in the PR.

Sponsors

License

MIT License © 2024-PRESENT 三咲智子

Keywords

FAQs

Package last updated on 12 Feb 2025

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc